Re:Let’s Stop the Unix Time Insanity
by mikeash on Monday December 02, 2013 @07:34PM
(#6837683)
The fact that dates in general are so screwed up is a great advantage for UNIX timestamps.
A single moment in time maps to a single UNIX timestamp and back again with almost no complications or exceptions (the only one I'm aware of being leap seconds, which is fairly minor). This makes it a great way to store and manipulate actual time.
It's then complicated, sometimes enormously complicated, to go from this simple representation to what humans would call a "date". But that's unavoidable, and by using something nice and simple like UNIX time in the backend, you ensure that all of the craziness when dealing with weird human systems stays at the front end where it belongs.
It's not always possible, of course. Some systems need to store "dates" in terms of what humans think they are, not actual moments in time. (For example, storing a birthday as UNIX time would be a bad idea.) But whenever you want an actual moment in time, UNIX time is great.
A single moment in time maps to a single UNIX timestamp and back again with almost no complications or exceptions (the only one I'm aware of being leap seconds, which is fairly minor). This makes it a great way to store and manipulate actual time.
It's then complicated, sometimes enormously complicated, to go from this simple representation to what humans would call a "date". But that's unavoidable, and by using something nice and simple like UNIX time in the backend, you ensure that all of the craziness when dealing with weird human systems stays at the front end where it belongs.
It's not always possible, of course. Some systems need to store "dates" in terms of what humans think they are, not actual moments in time. (For example, storing a birthday as UNIX time would be a bad idea.) But whenever you want an actual moment in time, UNIX time is great.