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.
[ Parent
| on HN ]
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.