Documentation
¶
Overview ¶
Package solar provides a thin wrapper around github.com/mstephenholl/go-solar for computing sunrise/sunset and determining whether a given UTC instant is during daytime or nighttime.
The wrapper preserves the historical API used throughout this repository (Calculate, SunTimes, IsNight) while delegating the underlying astronomical math to go-solar.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SunTimes ¶
SunTimes holds sunrise and sunset times for a given date and location.
func Calculate ¶
Calculate computes sunrise and sunset UTC times for a given date, latitude, and longitude. Computation is delegated to github.com/mstephenholl/go-solar.
Edge cases:
- Polar night (sun never rises): both Sunrise and Sunset are set to the start of the UTC day, so any time on that day is considered "night".
- Midnight sun (sun never sets): Sunrise is set to the start of the UTC day and Sunset to 23:59:59 UTC, so any time on that day is considered "day".
Click to show internal directories.
Click to hide internal directories.