by adrian_b · 4y ago · 0 comments
Only time differences do not have a timezone.
When Python continues to use the word "timestamp" for a time value with an unknown time zone, then that is the fault of Python, because the name is completely inappropriate.
I assume that whoever enabled a value "None" to be possible for the timezone did not really expect that anyone will ever use a timestamp with unknown timezone, but that in such cases there is a timezone known to the programmer, which is not stored with the timestamps, and that it is the responsibility of the programmer to restore the timezone whenever necessary.
A Unix timestamp is a difference in time, not a time point. It's a number of seconds. It's a duration, not an instant, which is why it doesn't in and of itself need a time zone attached.
That being said, people do use timestamps to represent time points sometimes, and that does requires picking a particular timezone. That's fine too, but it's not the only use or meaning of a timestamp. It doesn't make timestamps without time zones meaningless, and doesn't mean they implicitly refer to the UTC epoch.
Durations and time differences are timezoneless numbers. When you add a duration to a time point (like the Unix epoch in your preferred timezone), you get another time point, in the same timezone.
The number of seconds since what, exactly?
It appears to be the number of seconds since Jan 1, 1970, at midnight... in some timezone.
What they're saying is correct in the most technical sense, but our industry has landed on timestamps not needing timezones. If they want to work in this industry, they need to accept that.
It's ok to be surprised by something like this, it's less ok to argue about it.
The big problem with the python API, in my opinion, is that they conflate these two very different concepts in a single type.