Black Sheep Code

There are multiple ways to represent timezones - we can talk in terms of their GMT/UTC offset, which is helpful as developers, but as humans we often want to talk in location 'Whatever the time is in New York'.

The tz database is such a collection of human readable and location specific timezones, that you're probably already familiar with, with the format 'America/New_York' or 'Europe/London'.

The collection also includes a series of timezones of the format 'Etc/GMT+6' or 'Etc/GMT-6'.

I was using such timezones recently, to test the behaviour of how some timezone specific code worked with datetimes that would be on different days in different timezones.

Using timezones that explicitly state the offset is handy, because it removes the cognitive burden of having to look up 'Oh yeah America/New_York is UTC-5 or UTC-4 depending on daylight savings time, which is...'.

Unbeknownst to me - the Etc/GMT+6 timezone, actually means UTC-6!

According to Wikipedia:

The special area of "Etc" is used for some administrative zones, particularly for "Etc/UTC" which represents Coordinated Universal Time. In order to conform with the POSIX style, those zone names beginning with "Etc/GMT" have their sign reversed from the standard ISO 8601 convention. In the "Etc" area, zones west of GMT have a positive sign and those east have a negative sign in their name (e.g "Etc/GMT-14" is 14 hours ahead of GMT).

The character 'Anger' from the movie 'Inside Out'

Well that's just nice and confusing.

It does appear that POSIX configurations are indeed reversed. For example here's some Oracle documentation Permalink that states:

For example, GST-10 is a zone named GST that is 10 hours ahead (east) of UTC.

Something to keep in mind.

Spotted an error? Edit this page with Github