dpyTime Namespace Reference

Time utility methods.

Classes

class  SunTimes
 Sunrise/Sunset calculator (NOAA-style) More...
 

Functions

std::string getLocalTimeStamp ()
 Get local time as a timestamp string. More...
 
struct tm getLocalTime ()
 Get local time. More...
 
bool getSunriseSunsetLocal (const std::tm &localDate, double latitudeDeg, double longitudeDeg, SunTimes::ZenithPreset preset, std::time_t &sunriseLocal, std::time_t &sunsetLocal)
 Convenience wrapper to get sunrise/sunset for a date/location (LOCAL time_t outputs). More...
 
bool getSunriseSunsetLocal (std::time_t nowLocal, double latitudeDeg, double longitudeDeg, SunTimes::ZenithPreset preset, std::time_t &sunriseLocal, std::time_t &sunsetLocal)
 Convenience wrapper to get the sunrise/sunset interval that applies to a local instant. More...
 
bool isDayLocal (std::time_t nowLocal, double latitudeDeg, double longitudeDeg, SunTimes::ZenithPreset preset)
 Convenience wrapper: is it day at nowLocal for given location/preset? More...
 

Function Documentation

◆ getLocalTime()

struct tm dpyTime::getLocalTime ( )
Returns
tm struct with local time data

◆ getLocalTimeStamp()

std::string dpyTime::getLocalTimeStamp ( )

Format : ISO String

Returns
timestamp string with the full timestamp

◆ getSunriseSunsetLocal() [1/2]

bool dpyTime::getSunriseSunsetLocal ( const std::tm &  localDate,
double  latitudeDeg,
double  longitudeDeg,
SunTimes::ZenithPreset  preset,
std::time_t &  sunriseLocal,
std::time_t &  sunsetLocal 
)

Uses std::tm date fields (tm_mday, tm_mon, tm_year).

Returns
true if sunrise/sunset could be represented for that date, false on computation errors.

◆ getSunriseSunsetLocal() [2/2]

bool dpyTime::getSunriseSunsetLocal ( std::time_t  nowLocal,
double  latitudeDeg,
double  longitudeDeg,
SunTimes::ZenithPreset  preset,
std::time_t &  sunriseLocal,
std::time_t &  sunsetLocal 
)

Unlike the calendar-date overload, this returns the daylight interval that contains nowLocal when one exists across a midnight boundary.

Returns
true if sunrise/sunset could be represented for that instant/location, false on computation errors.

◆ isDayLocal()

bool dpyTime::isDayLocal ( std::time_t  nowLocal,
double  latitudeDeg,
double  longitudeDeg,
SunTimes::ZenithPreset  preset 
)
Returns
true if it is day, false otherwise.