Re:Setting the clock ahead to see what breaks
by tluyben2 on Tuesday January 24, 2023 @06:16AM
(#34502212)
I am that donkey banging it's head on the same post; when I see dates stores without TZ, I assume it's UTC and have done so for decades. It's turned out to almost never be true.
Re:Setting the clock ahead to see what breaks
by Eddy_Viscosity2 on Tuesday January 24, 2023 @08:01AM
(#34503043)
> preferably UTC
Yes! I have spent so much time detangling timestamps in data which used non-UTC times and non-standard formats. Like 06-10-01 WTF is that? Use UTC and then let the reader translate to local time on display.
Re:Setting the clock ahead to see what breaks
by dpcx on Tuesday January 24, 2023 @08:48AM
(#34503468)
My understanding is that you don't even want to store them as UTC and always store them in the timezone of the user/system that generated the data since you lose some information in the translation from local timezone to UTC - given that the timezone database changes, you may actually want to know that the record created in Fiji before 2022-10-28[1] was stored in DST so that it can be properly converted to the new Fiji time.
Re:Setting the clock ahead to see what breaks
by bouke on Tuesday January 24, 2023 @09:08AM
(#34503706)
This! People mistake the offset for the timezone, which is incorrect. The offset isn't very useful other than a guestimate of the originating timezone.
Re:Setting the clock ahead to see what breaks
by cratermoon on Tuesday January 24, 2023 @10:49AM
(#34505086)
Ideally store both, UTC and original local time, or at least the original TZ information. Time and timezone are a huge mess and one of the worst things to try deal with in programming.
Re:Setting the clock ahead to see what breaks
by cratermoon on Tuesday January 24, 2023 @10:45AM
(#34505020)
In the airline industry they sling huge numbers of dates and times around, and they never include the timezone. What do they include? The airport code. Boarding, departure, arrival, and all other times are always local to the airport. In practice, that means that every piece of code that wants to handle datetimes has to also have access to a way to lookup the timezone for the provided airport code. Have a time at LAX? look up LAX, find the timezone, and compute the offset.
In practice, almost nothing does TZ conversions or datetime math. In effect, airline timestamps are a tuple <datetime, airport_code>, and nothing much messes with that.
Re:Setting the clock ahead to see what breaks
by pstadler on Tuesday January 24, 2023 @05:20PM
(#34511402)
Doesn’t sound great. It‘s also an industry plagued by legacy systems.
Re:Setting the clock ahead to see what breaks
by cratermoon on Tuesday January 24, 2023 @07:27PM
(#34512639)
Oh, it's not great at all. The only upside to it is that passengers looking at schedules and boarding passes don't have to do any timezone conversions for long flights. The departure time is always the time at the origin, and the arrival time is always the time at the destination.
I‘ve been bitten by dates lacking timezones in various situations during my career and it has always been a pain in the ass to debug and resolve all those random problems they‘re causing.
Do. Save. Dates. Containing. Timezones.