Live data from Hacker News

Why You Should Use Timezone Offsets Not Timezone Names

tantek.com

31–40 of 51 posts

Re: Why You Should Use Timezone Offsets Not Timezone Names

#31
post #27

Earlier quoted context omitted.

Which is why you are both right: Offsets are good for past events, time zones for future ones. It's a real pain to deal with..

If you're using the Olsen Database[0], aren't past (and future) changes all handled properly? [0] https://en.wikipedia.org/wiki/Tz_database See: Example zone and rule lines

I suppose storing the offset is safer, because you have in a single string all you need to know to convert the time to UTC, but yes, that was my thought as well -- given a non-broken copy of tzdata, historical dates should be correctly convertible if all you have is a date/time and a timezone name.

Re: Why You Should Use Timezone Offsets Not Timezone Names

#32
post #18
post #15

Earlier quoted context omitted.

I wish they could at least store it in terms of the timezone name, like "Central Time". "America/Chicago" bothers me because I don't know what cities are and aren't in your timezone database. The ones that have a tiny map that you have to click on are also pretty bad.

CST is not the same thing as America/Chicago. If you say CST you specifically do not mean daylight savings time, which is CDT.

Sure, but the parent didn't say "CST". For a user-facing interface, presenting random city names is terrible. "Central Time" is a known entity among users, and they implicitly assume that it will take care of the difference between CST and CDT (and in fact, the named timezone CST6CDT does exactly that). Hell, if Chicago one day decided to be like a few of the "weird" US cities and not follow the standard DST schedule anymore, then "America/Chicago" would suddenly not represent most of the users in what's colloquially known as "Central Time". Better to use a name like "CST6CDT" that's independent of a particular city, and thus independent of the political whims of a local government.

Re: Why You Should Use Timezone Offsets Not Timezone Names

#33

I just DONT want to deal with time EVER. It's such a mess. Can't we just.. i don't know. throw away the current system and actually build something that a programmer can understand? Who counts to 24 and 60 anyway?

Yeah, like, let's meet at 1439193801. Quite nerdy though :)

Re: Why You Should Use Timezone Offsets Not Timezone Names

#34
> Data that’s harder for humans to inspect and verify is also more prone to errors, especially small passive errors that go unnoticed. Programmers who have to debug such data are humans. Harder for them means harder to debug, means more bugs that survive longer. QED.

This is apparently an argument against UTC, but I think it's an argument against local time instead - humans comparing times stored in different timezones causes a lot of errors.

Re: Why You Should Use Timezone Offsets Not Timezone Names

#35
In Meekan we help schedule meetings based on time ranges, like "9am in the next 3 weeks". We obviously store scheduled event times in UTC. However, that "in the next 3 weeks" day range could change offset in the middle, so we have to keep which timezone we're talking in. As kristiandupont said - timezones are great for future ones.

Also, when presenting times to users, knowing what timezone they're in, helps us display the dates with the correct offsets (without need to change it twice a year).

Timezone codes are useful. They're better in offsets in any way since they contain more data. It's one of those headaches for developers that save headaches to the users.

Re: Why You Should Use Timezone Offsets Not Timezone Names

#36
post #21

I collect the users city on my site using gps/browser location opt in, or by autocomplete against google locations. Has anyone figured out a way for me to get the users timezone from their city?

Be aware of VPN, traveling users, and incorrect data. This kind of information should only be used to default preferences.

Re: Why You Should Use Timezone Offsets Not Timezone Names

#37
First of all, time is a relative quantity, therefore we can only measure distance in time from something.

Secondly, time units do not have a fixed reference clock. `Second` is clocked by the Universe, `day` is clocked by midnight and year is clocked by New Year. Generally, by `time` we mean "distance in time since last Midnight in one second resolution" and that includes single clock source. By `date` we generally mean "distance in time since last particular arbitrary event in one day resolution", which includes two clock sources (midnight and new year). This gets rather awkward, but both sources get controlled by the "particular arbitrary event", therefore we can handle that. Combining both definitions into "distance in time since arbitrary event in one second resolution" gives us `datetime`, controlled by three clock sources. Thing are bound to get awkward.

Lastly, as others have already pointed out, all this makes definitions of future events in `datetime` pretty much useless, because there is no way to predict how many ticks clock sources will generate, unless you stick with one (e.g. n Universe clocked seconds from NOW (isn't TAI exactly that?)) and deal with fluctuating clock sources in the future.

Neither solution solve inherent problems with multi-clocked `datetime` definition only might make some problems easier to solve by shifting clock tracking to frontend: 2051-09-12 16:23:00 +0300 does not need to keep track of clock sources while 2051-09-12 16:23:00 Europe/Vilnius does.

The whole "Bonus" section is about arbitrary{ty|ness} of "last midnight" - how long ago did it actually happen for this moving target? Should I consider offset from last midnight from time I have actually seen it or when it was supposed to be seen here? Automatic time zone settings attempt to do the latter. And if you want former semantics, well just do not use automagic and add whole new clock source to this mess - "distance in time since last time I personally thought it was midnight".

Re: Why You Should Use Timezone Offsets Not Timezone Names

#38
post #32
post #18

Earlier quoted context omitted.

CST is not the same thing as America/Chicago. If you say CST you specifically do not mean daylight savings time, which is CDT.

Sure, but the parent didn't say "CST". For a user-facing interface, presenting random city names is terrible. "Central Time" is a known entity among users, and they implicitly assume that it will take care of the difference between CST and CDT (and in fact, the named timezone CST6CDT does exactly that). Hell, if Chicago one day decided to be like a few of the "weird" US cities and not follow the standard DST schedule…

Not necessarily. I am giving a talk in San Marcos, TX at 11am next week, but I have no idea what time zone it is in as I am not American.

Re: Why You Should Use Timezone Offsets Not Timezone Names

#39
post #31
post #27

Earlier quoted context omitted.

If you're using the Olsen Database[0], aren't past (and future) changes all handled properly? [0] https://en.wikipedia.org/wiki/Tz_database See: Example zone and rule lines

I suppose storing the offset is safer, because you have in a single string all you need to know to convert the time to UTC, but yes, that was my thought as well -- given a non-broken copy of tzdata, historical dates should be correctly convertible if all you have is a date/time and a timezone name.

Storing the offset won't work for future dates due to daylight savings changes.

Re: Why You Should Use Timezone Offsets Not Timezone Names

#40
post #15

The political realities of timezones is _exactly why_ you should be storing the timezone name if the user is scheduling it for an event in their local timezone. If a user is expecting an event to happen at 6pm in their local timezone, and political reasons cause that timezone's offset to change (ie. daylight savings), it will still happen at the correct local time for that user. Storing UTC offsets means that any fut…

I wish they could at least store it in terms of the timezone name, like "Central Time". "America/Chicago" bothers me because I don't know what cities are and aren't in your timezone database. The ones that have a tiny map that you have to click on are also pretty bad.

Central to where? The other 96% of the world that are not in the US don't agree with your very specific notion of "central".
Post reply on HN