Well, depends on what abstraction level you are working on. If you're only working with a date & time library (like you should!) instead of trying to do everything yourself, it's actually often not that complicated for the programmer.
I can tell you, as a dev who works with Dates and Times as the primary product - Those libraries also still have bugs. They're just more likely to be smaller edge cases.
Ex: Brazil decided not to change clocks again for DST in 2019. And we had Newfoundland clocks as an hour off - but no one noticed because the total pop is only about 500k and we had just a single customer in the area.
Or they have basic date usage. As soon as you get into calculations, especially if you have to link that with a UI, you're gonna have tens of QA issues listed.
Having a library doesn’t mean you’re done with it though.
It just means you’re set a dam between you and the complexity, and the day the dam inevitably cracks or overflows you’re still getting wet, very wet.
Either you flee from area to area so that you’re never there when the dams cracks, or you fix dams so often that you effectively became a dam engineer and you ended up internalizing all the complexity and spend your free time swimming on the other side.
yeah, whoever said UTC was less hastle wasn't taking into account humans penchant for wanting illogical things.
We store date times in UTC, but spoiler alert, the offset from UTC is different depending on if you are in DST right now or not, and while it's technically correct, users got mad that the datediff between two date times both at noon 6 months apart return 182 days and one hour instead of exactly 182 days, because it was considered "too much work" to store the offset at the time of storage, we wrote our own method to convert to UTC ignoring DST
At a point we made sure to have fancy pants library parsing and restoring every flavor of 8601 and most common formats, to store them in plain UTC in DB.
Then we realized one of the older system had everything fixed in UTC+2 ignoring DST. Then another system handled DST, but with an outdated database.
Then when we had most issues sorted, it was deemed reliable and we got a request to trigger a reminder 15min before a given event on the client app. Long story short, we basically reinvented NTP just to deal with the lag and funky settings. Never again.
That's why you have names for timezones like America/Los_Angeles rather than UTC-7 or PDT. That way your timezone library can convert between civil time (what's on a clock) and absolute time (no ambiguities) even over these complicated scenarios.
Thank you for the link. I'm just getting into coding, finishing up CS50 right now. And damn, I haven't laughed that hard in a while. It was nice watching the video knowing it would end with that quote!
They aren't. Want proof? Try writing an algorithm that will tell you when easter occurs for a given year.
EDIT: I hadn't expected people to jump up to the challenge, but the amount of people starting their solutions with "Given ____..." kind of hints at how non-straightforward it is.
343
u/tinydonuts May 16 '20
Someone argued with me in another thread that dates and times are dead simple.