Korva is a scroll of the internet’s best ideas.

Never write your own time zone code
A Pile Of Exceptions
Each exception looks reasonable on its own. Australia has a zone 9 and a half hours ahead of Greenwich, so a special case goes in. Nepal is on an offset of its own, so another special case goes in. Daylight saving changes on a different day in each country, so a whole file of dates goes in. Then come leap seconds, Samoa's skipped day, and wartime double summer time.
Spaghetti That Works
Soon the code is a tangled mess of spaghetti that somehow works, and every new phone call from a different country adds to it. Even the canonical list that records every time zone in the world cannot settle cases where two populations in one place follow different clocks.
Use Open Source
The way out is to put away your own code and go to the people who have been there before you, the ones who built the spaghetti and made it open source. Thank them, give them credit, put what they made into your program, and never look at it again, because that way lies madness.
Why are some time zones offset by half an hour?
India runs at 5 hours 30 minutes ahead of UTC, and the Australian state of South Australia and the Northern Territory sit 9 hours 30 minutes ahead. Nepal uses 5 hours 45 minutes, and the Chatham Islands of New Zealand use 12 hours 45 minutes. Each came from a government choosing a local mean time near its capital or a compromise across a wide country. Programs that assume offsets are whole hours get these places wrong.
What is the tz database, and who started it?
Arthur David Olson started the collection in the 1980s, which is why it is sometimes called the Olson database. It names zones after regions and cities, such as America/New_York, and records every rule change for each one. Volunteers now maintain it, and it is hosted by the Internet Assigned Numbers Authority. Almost every operating system and programming language uses it.
Why do zone names use cities instead of offsets?
An offset alone cannot say when daylight saving starts or how the rules changed over past decades. A city based name points to a full history of rules for that region. When a country changes its laws, only the data behind the name changes. Dates stored with the name therefore stay meaningful.
More from Computerphile
