At a conference once I attended a talk by... I don't remember, but I think he was one of the main developers on #Perl's DateTime module.
My take-away was pretty much: "Guys, this timekeeping stuff is so hard, you have no idea."
So what I learned, really, was never try to roll your own #time library. People who have worked on it for years say it's basically impossible. Use their code; at least it will be less wrong than whatever you would have come up with.

Mark Gardner
in reply to Triskaideka • • •This section of a larger “falsehoods programmers believe in” page has almost two dozen links to articles explaining why dates, times, time zones, durations, and calendars are so hard: github.com/kdeldycke/awesome-f…
If I never debug date and time issues again it will be too soon, but I suspect the only solution is retirement.
awesome-falsehood/readme.md at main · kdeldycke/awesome-falsehood
GitHubTriskaideka
in reply to Mark Gardner • • •