Software developers work with dates and times on a regular basis. We understand the rules for determining leap years, the methods for calculating time spans, and the proper use of time offsets from Coordinated Universal Time.
Unfortunately, when it comes to summer-time versus winter-time there’s a big gap in our understanding. Relying on the time broadcast from the nearest cell-phone tower may be good enough for lay people, but programmers need to know a lot more.
Standard time zones
We know that standard time is nominally sliced into 24 zones, each of 15 degrees longitude. But the true list of standard times is not that clean, because many places have decided to stretch and pull time zone borders to fit administrative borders. This has given rise to time zones that are unusually wide, such as China, whose eastern limit at 73.5°E, and western limit at 134.5°E, spans four nominal time zones.
Other countries have adopted time zones that don’t neatly fit the usual one hour increment. For example, India standard time is 30 minutes different from neighboring Pakistan and Bangladesh. And strange as it may seem, Nepal standard time is set at the 45 minute mark, meaning clocks in Kathmandu are two hours and fifteen minutes behind its neighbor to the north.
Furthermore, in the South Pacific, some islands have decided to align their clocks with the east and others with the west. They’ve contorted those 24 nominal slices into 26 actual zones. This may seem odd to mainlanders, but it does prevent the awkwardness and confusion of dealing with trading partners whose clocks and calendars might otherwise be different.
And then there’s daylight saving time. This perplexing idea and its non-uniform set of rules has been generating controversy ever since it was first tried in 1916.
Nobody likes the idea of getting out of bed at 4 o’clock in the morning, even if that’s when the sun rises. So why not get up at 5 o’clock, and use that extra hour of summer daylight to do some extra work in the evening.
At different times over the past century, daylight saving time has been enacted or repealed by countries which have justified their reasoning in a variety of ways: wartime production schedules; the availability and price of oil; computerized electoral machines that couldn’t be reprogrammed; severe drought drying up hydroelectric dams; better use of national tourist attractions; accommodating the daylight fasting rules of Ramadan. And in one case — favoring restaurant diners over beach-goers!
The rules keep changing. Savvy programmers must take defensive action in whatever implementation they choose. Here’s a round-the-world examination of the daylight saving rules for 2021.
For the list of zones for the whole world see Medium.com
Data files for software developers
Time zone data and daylight time rules are administered by the Internet Assigned Numbers Authority. The Time Zone Database is available for download from IANA.
This database is maintained by volunteers who submit changes that they learn about through local news. Every country in the world is free to use whatever time zones and whatever daylight rules they wish, and they are under no obligation to inform IANA about any changes. Volunteers are needed to keep the database up-to-date.
Daylight saving time data files for 2021 can be obtained from the daylight-saving-time-2021 GitHub repo.
Time zone data visualization is available at timezone.earth.
Top comments (0)