Sunrise/Sunset calculator (NOAA-style)
More...
#include <timeUtils.h>
|
| enum | ZenithPreset { Official,
Civil,
Nautical,
Astronomical
} |
| |
|
|
| SunTimes (double latitudeDeg, double longitudeDeg, ZenithPreset preset=ZenithPreset::Official) |
| |
|
| SunTimes (double latitudeDeg, double longitudeDeg, double zenithDeg) |
| |
| bool | compute (const std::tm &localDate, std::time_t &sunriseLocal, std::time_t &sunsetLocal) const |
| | Compute sunrise/sunset for given local calendar date. More...
|
| |
| bool | compute (std::time_t currentLocal, std::time_t &sunriseLocal, std::time_t &sunsetLocal) const |
| | Compute sunrise/sunset for the date of a given local time_t. More...
|
| |
| bool | isDay (std::time_t nowLocal) const |
| | Determine daylight state for a local instant. More...
|
| |
|
|
static double | zenithDeg (ZenithPreset preset) |
| |
- longitude: East positive, West negative
- returns sunrise/sunset as time_t instants in LOCAL time
◆ compute() [1/2]
| bool compute |
( |
const std::tm & |
localDate, |
|
|
std::time_t & |
sunriseLocal, |
|
|
std::time_t & |
sunsetLocal |
|
) |
| const |
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. Polar day returns the previous real sunrise and the next real sunset. Polar night returns the next real sunrise and the previous real sunset.
◆ compute() [2/2]
| bool compute |
( |
std::time_t |
currentLocal, |
|
|
std::time_t & |
sunriseLocal, |
|
|
std::time_t & |
sunsetLocal |
|
) |
| const |
- Returns
- true if sunrise/sunset could be represented for that date, false on computation errors.
◆ isDay()
| bool isDay |
( |
std::time_t |
nowLocal | ) |
const |
- Returns
- true if
nowLocal is within daylight, false otherwise. For polar day/night, daylight is inferred from the surrounding real sunrise/sunset events returned by compute.