4 ms·
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
by zensavona 11y ago
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 https://github.com/bitwalker/timex
[1] https://en.wikipedia.org/wiki/Tz_database#Area https://en.wikipedia.org/wiki/Tz_database#Area
- return0 11y agoWow! Good thing that out of habit i always used "UTC".
- laut 11y agoDepending on what you need to do, UTC does not always work: http://www.creativedeletion.com/2015/03/19/persisting_future_datetimes.html http://www.creativedeletion.com/2015/03/19/persisting_future...
- laut 11y agoHi. I'm the author of the article. And also of Elixir Tzdata and https://github.com/lau/calendar 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?
- majewsky 11y agoMaybe 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.