5 ms·
Epoch doesn't carry timezone information.
by foepys 7y ago
Epoch doesn't carry timezone information.
- masukomi 7y agoepoch is INHERENTLY timestamped it's seconds since January 1, 1970 (midnight UTC/GMT). it'd be useless if it was just "you know midnight _somewhere_ on Jan 1 1970... pfft it was a long time ago. who cares"
- lucasmullens 7y agoWhen you go one hour back for daylight savings, you can't tell with just epoch if it's the first or second time you're at that time. With timezones you can, since it switches between PST and PDT.
- wahern 7y ago1:30PST and 1:30PDT bijectively map to distinct UTC timestamps.
- alpaca128 7y agoI don't know that much about epoch, but isn't the point of it to be completely independent of stuff like timezones or daylight savings? Doesn't it track every second since 1970 no matter if meanwhile time jumped back or forward in some countries?
- CameronNemo 7y agoUTC has leap seconds, but otherwise this is correct.
- kyralis 7y agoThis is fundamentally incorrect. Because UTC doesn't change, the two "identical" times are different UTC values.
- foepys 7y agoWhat happened when you set an alarm for 2022 in CEST? The EU will very likely get rid of DST by then. You alarm will be an hour off when you convert to UTC beforehand.
- xgbi 7y agoAnd it better not. Timezone information has nothing to do in a timestamp. A timestamp is a point in time, whatever the time is in Paris or Tokyo. It is an abstract value and it is way better this way. A timezone is a filter through which you display your timestamp, and it tells you what your local time was when that timestamp occurred. So yeah, always store and exchange time information as timestamps. Timezone is extra styling information, just like CSS.
- filleduchaos 7y ago> A timestamp is a point in time, whatever the time is in Paris or Tokyo. It is an abstract value and it is way better this way. > Timezone is extra styling information, just like CSS. This is an incredibly reductive view of time data and the possible applications that use it. Not all time data is timestamps, and UTC timestamps strip out information that is not "styling".
- foepys 7y agoNo, timezone information can be critical and assuming you can always strip it is just wrong. You might not have encountered such scenarios but they are very much out there.
- rumanator 7y ago> No, timezone information can be critical and assuming you can always strip it is just wrong. Expressing time based on the standard reference timezones (i.e., UTC) is not stripping the time zone away.
- foepys 7y agoIt is. Timezones change all the time in relation to UTC. If you set a date in the future and think converting it to UTC doesn't lose information, you will be surprised when you get bitten by it. Example: The EU will most likely get rid of DST around 2022. Any time you set beforehand in CEST or CET will be an hour off, depending on which the EU will get rid of.aybe the EU doesn't get rid of DST and keeps it, you don't know. So unless you have a time machine, you cannot convert the time to UTC.
- rumanator 7y ago> Epoch doesn't carry timezone information. Dates should not be encoded with time zone info anyway, as timezones is context-dependent. Dates should be encoded in UTC and then let clients interpret them according to their context.
- foepys 7y agoWhat do you do when timezones change? This happens all the time around the world.