News for hackers. Stuff that matters.
Re:Rob Pike's Rules of Programming (1989) by karmakaze on Wednesday August 12, 2020 @05:52PM (#24137444)
The most interesting case of this I encountered was for photo 'timestamps' on a global sharing site. UTC was being used and I was proposing a change to local time. There was great debate as many drank the UTC juice and stopped thinking.

It was when I showed them that we also have a 'shot at' location then proceeded to show Christmas eve photos showing the UTC time converted to the viewers local timezone (not always evening, not always Dec 24) alongside where the photo was taken. Just as in space-time a photo needs both a time and a place.

Re:Rob Pike's Rules of Programming (1989) by rurounijones on Thursday August 13, 2020 @02:57AM (#24140673)
Sounds like the problem was images being uploaded with a timestamp without a timzeone, in which case neither solution would work.
Re:Rob Pike's Rules of Programming (1989) by karmakaze on Thursday August 13, 2020 @09:55AM (#24143344)
The timezone could be inferred from uploader's geoip as a fallback. The problem was that even if the timezone was known at time of upload it was converted to UTC and lost when stored.
Re:Rob Pike's Rules of Programming (1989) by Joker_vD on Thursday August 13, 2020 @06:01AM (#24141660)
For historical events, where the local time is important, the combination of "UTC timestamp" and "local time offset in effect at the moment the timestamp was taken" seems to be the choice. Allows you to easily learn what time the wall clock was showing at the moment.
Re:Rob Pike's Rules of Programming (1989) by karmakaze on Thursday August 13, 2020 @09:59AM (#24143387)
Databases have support for a single type that encodes exactly like this. In postgresql a timestamptz shows as 'yyyy-mm-dd hh:mm:ss.123456+1234' but internally it's stored as UTC unixtime and tz offset.
Re:Rob Pike's Rules of Programming (1989) by Joker_vD on Thursday August 13, 2020 @10:33AM (#24143718)
Doesn't it actually store the timezone's IANA name and uses the tzdata to do conversions? That implies slightly more work than storing just the effective timezone offset, but is probably more correct when it comes to the timestamps in the future.
Re:Rob Pike's Rules of Programming (1989) by karmakaze on Thursday August 20, 2020 @05:18PM (#24229108)
Docs aren't 100% explicit but it seems that it uses tzdata etc to convert to offset as necessary and stores offset--that wouldn't affect correctness as the conversion is done now not in the future.