The Problem with Time & Timezones - Computerphile
Computerphile12 HN recommenders · recommended in 12 months, 2014–2026
explainer · general · evergreen · 2014–2026 on HN
Tom Scott explains for Computerphile why handling time and timezones in code is so hard, walking through a simple web app that computes how long ago something happened. It covers the quirks of timezones and calendars and ends in an exasperated rant.
It is the go-to funny, accessible explanation of why you should never implement datetime handling yourself, linked in nearly every timezone thread.
Up next
1 mo on HNTHE DUMBEST BOY ALIVE. PRETTY GOOD, EPISODE SIX.
Jon Bois
1 HN recommend · 2021–2025
3 mo on HNHoward Payne & Deviant Ollam - This Key is Your Key, This Key is My Key
DeviantOllam
3 HN recommender · 2017–2021
7 mo on HNElevator Hacking: From the Pit to the Penthouse
DeviantOllam
9 HN recommender · 2014–2026
1 mo on HNHow English sounds to non-English speakers
Brian and Karl
1 HN recommend · 2013–2017
8 mo on HNDebt: The First 5,000 Years | David Graeber | Talks at Google
Talks at Google
8 HN recommender · 2013–2024
8 mo on HNPlover: Thought to Text at 240 WPM
Next Day Video
8 HN recommender · 2014–2023
3 mo on HNRiding the Booster with enhanced sound
Michael Interbartolo
3 HN recommender · 2014–2014
6 mo on HNMonktoberfest 2016: Bryan Cantrill - Oral Tradition in Software Engineering
RedMonk Tech Events
6 HN recommender · 2016–2026
6 mo on HNYou Suck at Excel - Joel Spolsky (Reupload)
Cool Bug Facts
7 HN recommender · 2024–2026
5 mo on HNPure Functional Programming in Excel • Felienne Hermans • GOTO 2016
GOTO Conferences
5 HN recommender · 2017–2025
4 mo on HNThe Web That Never Was - Dylan Beattie
NDC Conferences
3 HN recommender · 2023–2026
5 mo on HNPlain Text - Dylan Beattie - NDC Copenhagen 2022
NDC Conferences
5 HN recommender · 2022–2025
12 comments from Hacker News
Obligatory post to Computerphile episode about Timezones - a must watch for developers just starting out with Timezones ▶ this video
This will probably resonate with people here[1]. A brilliant video by Tom Scott for Computerphile, where he starts to explain what coding timezones correctly is like and by the end of it is in full polite-mini-rant-mode :D [1] ▶ this video
That might work for the current form of the country-specific time zones officially acknowledged by countries that exist in TLD form, but the tz database contains many more current time zones more importantly piles of historical time zones. Representing just the historical forms of currently recognized time zones in DNS would be a mess, without even getting in to those that are not associated with a country that currently exists and has a TLD. edit: This is a great video explaining a lot of the reasons why time zones are nowhere close to as straightforward as you may think: ▶ this video
I have to toss this classic video on the issues with timezones and programming. The sheer amount of growing exasperation as the video goes is hilarious. ▶ this video The Problem with Time & Timezones - Computerphile / Tom Scott
Great question! Dates and times are one of the most loathed obstacles in writing software that needs to work a particular way across millions of devices situated all across the globe in different regions and time zones. In our case, we had a bit of code that aimed to measure the time until midnight/tomorrow. But when clocks change at midnight (jumping forward or backward), you can wind up with days that appear to be longer than 24 hours in length. And when a day is more than ~24hr in length, you wind up with unexpected answers to seemingly simple math equations. A bit of logic, responsible for setting up a timer, wound up scheduling numerous timers when our 'How long until tomorrow' code began returning negative numbers. That set of unintended timers locked-up the application itself. You can see our issue for the behavior here: link . For 10 minutes of anxiety, check out 'The Problem of Time & Timezones' from Tom Scott of Computerphile: ▶ this video . It's a fantastic summary of the issues programmers face when dealing with time :) Sampson (Brave Team)
That’s a hard question regardless of programming language. One commonly referenced YouTube video about time that explains why this is hard: ▶ this video A reasonable first approximation of a solution would be to just check every second (or minute, or hour, depending on requirements) whether the current system time is later than the scheduled time for any pending events. Then you probably want to make sure events are marked as completed so they don’t fire again if the clock moves backwards. Trying to predict how many seconds to sleep between now and 3pm on Saturday is a difficult task, but you can probably use a time library to do that if it’s important enough... but what happens when the government suddenly declares a sudden change to the time zone offset between now and then? The predictive solution would wake up at the wrong time.
> such a reasonable, trivial task? Tom Scott has a pretty good video explaining exactly why writing code about time is not trivial: The Problem with Time & Timezones - Computerphile ▶ this video
I really enjoyed this. And I think no one mentioned the very related Computerphile video yet: "The Problem with Time & Timezones " ▶ this video Same topic, equally entertaining (not AS geeky though).
>Just try to explain to everyday people just how hard the problem is A bit off topic but Computerphile / Tom Scott did an excellent video doing that ▶ this video
Computerphile did an excellent overview of time zones and all their complexities in the context of programming: ▶ this video I was quite surprised by some of the stranger rules out there, especially the regions that chose to skip a day for whatever reason. Timezones are complex! Far, far more complex than simple offsets.
There is a great (humorous) Computerphile video about this topic: "The Problem with Time & Timezones" [0] [0] ▶ this video
An excellent video touching on some of the intractable aspects of our datetime-marking system's personality quirks: ▶ this video