2 ms·
The thing is, time itself never jumps back. If you correctly encode your timestamps then you will never experience a discontinuity even if you use a local time
by globular-toast 7y ago
The thing is, time itself never jumps back. If you correctly encode your timestamps then you will never experience a discontinuity even if you use a local time zone. In the UK on the 29th March 2020 the time was 00:59:59 GMT and one second later it was 02:00:00 BST. There is no discontinuity there. 02:00:00 BST is 01:00:00 GMT. The mistake is to think the time zone is not part of the value. A "naïve" datetime (as the Python standard library calls it) is simply an incorrect way to store a timestamp.
Unfortunately it is Unix time that has a real discontinuity. This happens around leap seconds when Unix time will jump backwards or forwards by a whole number of seconds. This is actually the fault of UTC, though. Leap seconds are an abomination. Unix had the right idea all along which is to just count a number of seconds since an epoch and not worry about the movements of the solar system.