Index: /trunk/FACT++/src/Time.cc
===================================================================
--- /trunk/FACT++/src/Time.cc	(revision 19429)
+++ /trunk/FACT++/src/Time.cc	(revision 19430)
@@ -400,4 +400,102 @@
 //
 //! @returns
+//!     The time of the previous sun-set, relative to given horizon in degree,
+//!     for the observatory location given (see nova.h).
+//!     If the sun is circumpolar, it simply return the intgeral fraction of
+//!     the current MJD.
+//!     If libnova was not compiled in, it will return the next noon.
+//!
+//!  @throws
+//!     A runtime_error exception is thrown if the observatory location
+//!     is not defined (see nova.h)
+//
+Time Time::GetPrevSunSet(double horizon, const string &obs) const
+{
+#ifdef HAVE_NOVA
+    const Nova::LnLatPosn posn(obs);
+    if (!posn.isValid())
+        throw runtime_error("Observatory location '"+obs+"' unknown.");
+
+    ln_rst_time sun_day;
+    if (ln_get_solar_rst_horizon(JD()-0.5, const_cast<Nova::LnLatPosn*>(&posn), horizon, &sun_day)==1)
+        return Time(floor(Mjd()));
+
+    if (Time(sun_day.set)<*this)
+        return Time(sun_day.set);
+
+    if (ln_get_solar_rst_horizon(JD()-1.5, const_cast<Nova::LnLatPosn*>(&posn), horizon, &sun_day)==1)
+        return Time(floor(Mjd()));
+
+    return Time(sun_day.set);
+#else
+    return Time(floor(Mjd()-0.5)+0.5);
+#endif
+}
+
+// --------------------------------------------------------------------------
+//
+//! @returns
+//!     The time of the next sun-set, relative to given horizon in degree,
+//!     for the observatory location given (see nova.h).
+//!     If the sun is circumpolar, it simply return the intgeral fraction of
+//!     the current MJD+1.
+//!     If libnova was not compiled in, it will return the next noon.
+//!
+//!  @throws
+//!     A runtime_error exception is thrown if the observatory location
+//!     is not defined (see nova.h)
+//
+Time Time::GetNextSunSet(double horizon, const string &obs) const
+{
+#ifdef HAVE_NOVA
+    const Nova::LnLatPosn posn(obs);
+    if (!posn.isValid())
+        throw runtime_error("Observatory location '"+obs+"' unknown.");
+
+    ln_rst_time sun_day;
+    if (ln_get_solar_rst_horizon(JD()-0.5, const_cast<Nova::LnLatPosn*>(&posn), horizon, &sun_day)==1)
+        return Time(floor(Mjd())+1);
+
+    if (Time(sun_day.set)>=*this)
+        return Time(sun_day.set);
+
+    if (ln_get_solar_rst_horizon(JD()+0.5, const_cast<Nova::LnLatPosn*>(&posn), horizon, &sun_day)==1)
+        return Time(floor(Mjd())+1);
+
+    return Time(sun_day.set);
+#else
+    return Time(floor(Mjd()+0.5)+0.5);
+#endif
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls GetPrevSunSet(LN_SOLAR_STANDART_HORIZON)
+//
+Time Time::GetPrevSunSet(const string &obs) const
+{
+#ifdef HAVE_NOVA
+    return GetPrevSunSet(LN_SOLAR_STANDART_HORIZON, obs);
+#else
+    return GetPrevSunSet(-0.8333, obs);
+#endif
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls GetNextSunSet(LN_SOLAR_STANDART_HORIZON)
+//
+Time Time::GetNextSunSet(const string &obs) const
+{
+#ifdef HAVE_NOVA
+    return GetNextSunSet(LN_SOLAR_STANDART_HORIZON, obs);
+#else
+    return GetNextSunSet(-0.8333, obs);
+#endif
+}
+
+// --------------------------------------------------------------------------
+//
+//! @returns
 //!     Returns an int corresponding to the current sun-cycle, that means
 //!     the day of the last sun-rise w.r.t. this Time.
Index: /trunk/FACT++/src/Time.h
===================================================================
--- /trunk/FACT++/src/Time.h	(revision 19429)
+++ /trunk/FACT++/src/Time.h	(revision 19430)
@@ -120,4 +120,10 @@
     Time GetNextSunRise(const std::string &obs="") const;
 
+    Time GetPrevSunSet(double horizon, const std::string &obs="") const;
+    Time GetNextSunSet(double horizon, const std::string &obs="") const;
+
+    Time GetPrevSunSet(const std::string &obs="") const;
+    Time GetNextSunSet(const std::string &obs="") const;
+
     uint32_t NightAsInt(const std::string &obs="") const;
 };
