ZTime zonesAll posts
Time zones that are off by half an hour
About one person in five lives somewhere the clock is not a whole number of hours from UTC. Scheduling software forgets them with surprising regularity.
- Published
- Reading time
- 3 min · 656 words
- Line
- ZTime zones
- Written by
- ARAnanya Rao · Engineer, time zones
In this post 3 stops
I work from Bengaluru, five and a half hours ahead of UTC. In my first week at Halfpast a colleague in London proposed a call “at 2 your time” using a tool I will not name. It arrived in my calendar at 14:30. The tool had rounded India to the nearest hour, and then apologised for nothing.
Half-hour zones are treated as a curiosity, a pub-quiz fact about Nepal. They are not rare. India alone is about 1.4 billion people, and every one of them is thirty minutes off the grid that most slot pickers assume.
Who lives off the hour
| Place | Offset | Worth knowing |
|---|---|---|
| India, Sri Lanka | +5:30 | No clock changes |
| Nepal | +5:45 | One of the few quarter-hour zones |
| Iran | +3:30 | Stopped changing its clocks in 2022 |
| Afghanistan | +4:30 | No clock changes |
| Myanmar | +6:30 | No clock changes |
| South Australia | +9:30 | Moves to +10:30 in summer |
| Northern Territory | +9:30 | Same offset, never changes |
| Newfoundland | −3:30 | Moves to −2:30 in summer |
| Lord Howe Island | +10:30 | Its summer shift is 30 minutes |
| Chatham Islands | +12:45 | Moves to +13:45 in summer |
Two rows deserve a second look. Adelaide and Darwin share an offset for half the year and differ for the other half. And Lord Howe Island moves its clocks forward by thirty minutes, not sixty, which breaks any code that treats daylight saving as “add one hour”.
LondonUTC+0
BengaluruUTC+5:30
KathmanduUTC+5:45
St John'sUTC−3:30
Four ways software gets it wrong
Storing the offset as a whole number
Somewhere there is a database column called utc_offset with the type integer. India is saved as 5 or 6, depending on how the rounding felt that day. Every meeting is then wrong by thirty minutes, in a direction that changes with the code path.
Storing the offset at all
An offset is a fact about one instant. Adelaide is +9:30 in July and +10:30 in January. A booking saved as “10:00 at +9:30” for a date in summer is an hour out before anyone has done anything. Save the zone's name, Australia/Adelaide, and let the time zone database do the rest.
Snapping slots to the guest's hour
A host in London offers 09:00, 09:30 and 10:00. To a guest in Kathmandu those are 14:45, 15:15 and 15:45. Some pickers “tidy” these to 15:00 and 16:00, and the guest arrives fifteen minutes late to a meeting they booked correctly. Slots belong to the host's clock. Show the guest the real times, odd minutes included.
Assuming everyone changes clocks together
London and New York are five hours apart, except for the two or three weeks in March and one in the autumn when they are four. India never changes. A weekly call between London and Bengaluru moves by an hour for one of them twice a year, and somebody has to be told which.
An offset is a fact about one instant. A zone is a promise about all of them.
The rules we build by
- Store instants in UTC and zones by name. Never store an offset.
- Generate slots on the host's clock, convert each one to the guest's zone, and display the result without rounding.
- Say whose time it is, on the page: “Times shown in India Standard Time”. Let the guest change it.
- Test with Kathmandu, Adelaide and Lord Howe Island. If those three pass, London to New York will look after itself.
- In the week of a clock change, show the change: “This meeting is at 15:30 for you this week, not 14:30.”
My 14:30 call was moved, eventually, to 14:00. The colleague who sent it now works on our slot generator. We both consider this justice.