4 ms·
If we simply stored all timestamps as "number of seconds since X" then we could safely convert that to whatever timezone, apply whatever leap adjustments, apply
by culi 2y ago
If we simply stored all timestamps as "number of seconds since X" then we could safely convert that to whatever timezone, apply whatever leap adjustments, apply daylight savings time, convert to whatever calendar, etc anywhere we want
Instead of browsers/libraries handling all the complexity (standards and localization, dst, leap seconds, etc), couldn't we just do all our math and logic in this format and then convert back to whatever when we need to display a time to a user.
It seems like saving a #seconds along with lat/long information is enough to handle all timestamp use-cases.
- lxgr 2y ago> If we simply stored all timestamps as "number of seconds since X" That works – if you never want to represent dates in the future (because we don't know how many leap seconds there will be in the future). But that way, you'd be incapable of implementing even a trivial calendar application involving more than one timezone. > couldn't we just do all our math and logic in this format and then convert back to whatever when we need to display a time to a user We could – using all the libraries encapsulating that complexity. > It seems like saving a #seconds along with lat/long information is enough to handle all timestamp use-cases. That's even worse, since often that's not available, and even if it is, now you need a database representing local UTC offsets as polygons on the surface of the earth!