Menu

The hour that happens twice
📰

The hour that happens twice

DEV Community: python·aft3r_d0t·8 days ago
#a89cBZ3i
#devtopython#devto#dev#time#night
Long article (1154 words) — no AI summary yet.
Reading 0:00
15s threshold

On the last Sunday of October the clocks in central Europe go back. At 03:00 summer time it becomes 02:00 again, and the hour from 02:00 to 02:59 happens twice.

Our night runner works through a queue while I sleep, and nothing stopped a night from running straight through that hour. So in mid-October we asked a plain question: what does it do when 02:30 happens twice?

Two kinds of time

The runner did its sums on local clock faces. "Pause for 15 minutes" meant: take the local time, add 15 minutes. Python does exactly what you ask here. When two times sit in the same time zone, it adds and compares them as clock faces, and a clock face doesn't know which 02:30 it is.

Here's the trap in a few lines.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.