Maybe you’re like me (well, earlier me), and have a vague idea that something is up with time.
Maybe you realized your code didn’t account for daylight saving changes, or maybe you ran into one of those “Falsehoods programmers believe about time” posts a while ago.
Some of the edge-cases relating to time are impossible to predict and are often unintentionally left untested:
- Leap seconds can make minutes last 61 seconds and only occur every 1.5 years on average.
- Time zones can change, scheduling future events can’t always be done using UTC timestamps.
This guide is not Go-specific, but understanding the underlying standards and tech is crucial when you start dealing with scheduling, logging or time manipulation in Go applications.
It covers UTC, time zones, daylight saving time, clocks, NTP and more.