FACT++  1.0
Time Time::GetPrevSunRise ( double  horizon) const
Returns
The time of the previous sun-rise, relative to given horizon in degree, for the coordinates of the ORM, La Palma. if libnova was not compiled in, it will return the next noon.
Exceptions
aruntime_error exception is thrown if the calculation of the sun-rise by libnova fails (this would happen if libnova thinks the sun is circumpolar which should never happen at La Palma)

Definition at line 313 of file Time.cc.

References JD(), Mjd(), Nova::ORM(), and Time().

Referenced by EventBuilderWrapper::InitRunNumber().

314 {
315 #ifdef HAVE_LIBNOVA
316  Nova::LnLatPosn obs = Nova::ORM();
317 
318  ln_rst_time sun_day;
319  if (ln_get_solar_rst_horizon(JD()-0.5, &obs, horizon, &sun_day)==1)
320  throw runtime_error("ln_get_solar_rst_horizon reported the sun to be circumpolar at the coordinates of La Palma!");
321 
322  if (Time(sun_day.rise)<*this)
323  return Time(sun_day.rise);
324 
325  if (ln_get_solar_rst_horizon(JD()-1.5, &obs, horizon, &sun_day)==1)
326  throw runtime_error("ln_get_solar_rst_horizon reported the sun to be circumpolar at the coordinates of La Palma!");
327 
328  return Time(sun_day.rise);
329 #else
330  return Time(floor(Mjd()-0.5)+0.5);
331 #endif
332 }
Time(enum init_t type=utc)
Definition: Time.cc:58
const LnLatPosn & ORM()
Definition: nova.h:66
double JD() const
Definition: Time.h:87
double Mjd() const
Definition: Time.cc:180
ln_lnlat_posn LnLatPosn
Definition: nova.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function: