News for hackers. Stuff that matters.
Re:Falsehoods programmers believe about time and time zones by zensavona on Sunday April 17, 2016 @06:11PM (#11516576)
One of the more interesting bugs I've created is in an Elixir program using the (great) Timex[0] library. I realised that for a few particular users, timezones were being inverted when converted (e.g. a user in GMT+5 would behave as if they were in GMT-5 and vice versa). After a lot of time spent proving to myself I was not actually going mad, I opened a Github issue and the library author informed me about one of the stranger quirks of timezones - the Etc/UTC-X timezones[1], which represent areas that don't have an assigned area (usually a continent, like Europe/Berlin).

"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/east of GMT.)"

[0] https://github.com/bitwalker/timex [1] https://en.wikipedia.org/wiki/Tz_database#Area

Re:Falsehoods programmers believe about time and time zones by laut on Sunday April 17, 2016 @11:29PM (#11517543)
Hi. I'm the author of the article. And also of Elixir Tzdata and https://github.com/lau/calendar I recommend using Calendar instead of Timex.

I'm curious: Why where you using e.g. GMT+5 or GMT-5?

Re:Falsehoods programmers believe about time and time zones by majewsky on Monday April 18, 2016 @03:27AM (#11518260)
Maybe the application only allowed to configure GMT offsets, rather than timezones? I saw an internal application at work that did exactly this, and there was a predictable mess twice a year when DST started or ended.
Re:Falsehoods programmers believe about time and time zones by return0 on Sunday April 17, 2016 @07:06PM (#11516765)
Wow! Good thing that out of habit i always used "UTC".
Re:Falsehoods programmers believe about time and time zones by laut on Monday April 18, 2016 @02:20PM (#11522035)
Depending on what you need to do, UTC does not always work: http://www.creativedeletion.com/2015/03/19/persisting_future...