by sillysaurusx · 3y ago · 0 comments
UTC is simple and unambiguous. Time is a number representing a fixed point in time. When displaying it for humans, convert it into human form. When this principle is applied everywhere, it’s hard to make mistakes.
My gut says that deprecating utc as the native time representation will be one of those ideas fervently embraced by a few, ignored by most, and then quietly forgotten about in a decade.
There is no assumed timezone for naive datetimes and different software treats it differently. What's being deprecated is methods to create naive datetimes that are implicitly UTC without just attaching that information to the object itself. In the new world everything is still in UTC and you convert to local time at the last minute but now you can be sure that the datetime object you got handed is actually UTC instead of it being a convention that isn't always honored.
This, I think, is the idea that will be quietly ignored in the long run.
That is what they said, but it is inaccurate
All time should be UTC until it is displayed
So a number without a timezone is seconds since epoch in UTC
That is "default" not naive
Some Python applications programmers made stupid mistakes so they change the library
Golly. On the face of it Python is a mess. And it is everywhere. Golly
A "naive" datetime is the one for which it is not known what the timezone is. The opposite is the one for which it is known. You can absolutely encode UTC timezones as seconds since epoch without any additional information (except that one bit that is needed to distinguish them from "naive" ones, which doesn't have to be a literal bit - it can be just a different data type, for example).
And, yes, it would sure be nice if we didn't have "naive" datetimes at all, and everything was always UTC. But there are too many datetimes recorded in the real world without enough information to recover the timezone and thus the precise UTC time, and they still need to be processed. The mistake was to make this the default behavior - but that is a very old one, dating back to earliest days of computing.
True. Fair
> A "naive" datetime is the one for which it is not known what the timezone is.
Then it is UTC
That is what UTC is for.
Software sux
Changing the Python libraries to try to fix buggy software strikes me, on the face of it, as a bad idea.
I am sensitive to this having recently worked with ode that stored time as a string, wall clock local, with no timezone.
And made time series data from it
Software sux, because programmers do silly things
Stop it!
And you must do it in UTC
But otherwise use UTC
A local time aware process has to be available for users. Of course
But in the backend it is UTC
Storing time any other way is a world of pain