Falsehoods programmers believe about time and time zones
creativedeletion.com
Falsehoods programmers believe about time and time zones
1–10 of 83 posts
Re: Falsehoods programmers believe about time and time zones
#2Re: Falsehoods programmers believe about time and time zones
#3What surprised me the most recently was that POSIX specifies timezone offsets the other way round from the rest of the world, and thus many parsing libraries will interpret something like "2016-1-1 12:00:00 GMT+2" as 14:00 in UTC, instead of 10:00.
Re: Falsehoods programmers believe about time and time zones
#4There are also examples of non-DST related time zone changes of up to 24 hours (mostly from Pacific islands deciding to change what side of the international date line they are on), so in some zones, there are certain entire days that never happened (e.g. the entire day is an "imaginary day") and some that happened "twice".
Re: Falsehoods programmers believe about time and time zones
#5What surprised me the most recently was that POSIX specifies timezone offsets the other way round from the rest of the world, and thus many parsing libraries will interpret something like "2016-1-1 12:00:00 GMT+2" as 14:00 in UTC, instead of 10:00.
It's extra tough to know what to do on that situation if you don't know the provenance of the timestamp, because there are some programs that output timestamps formatted like a POSIX TZ, but with the opposite sign convention.
Re: Falsehoods programmers believe about time and time zones
#6Timezones conversion is super hard, which is the exact reason I rely on libraries rather than trying to reinvent the wheel.
Re: Falsehoods programmers believe about time and time zones
#7Actually this isn't a falsehood, this is true.
Re: Falsehoods programmers believe about time and time zones
#8Re: Falsehoods programmers believe about time and time zones
#9Just look at all the code to deal with it in D (written by Jonathan Davis):