top | item 35202256

Let's restart counting Unix timestamp to from 2020

2 points| touchpadder | 3 years ago | reply

Old counting start date: Jan 01 1970 01:00:00 GMT+0100

New counting start date: Jan 1 2020 00:00:00 UTC+0000

Example in Dev Tools how to get the new epoch time

const newBeginning = new Date('Jan 1 2020 00:00:00 UTC+0000')

const newEpoch = Date.now() - newBeginning.getTime()

console.log('New epoch timestamp', newEpoch)

21 comments

order
[+] simonblack|3 years ago|reply
Sounds a bit like a solution in search of a problem.

There's no reason you can't use a 64-bit value in a 32-bit system. Much simpler to access the 64-bit value as two 32-bit words than propose a whole new confusing and ambiguous system.

In terms of current-time coding, the only time that second hi-order word would be used is when the lo-order word overflows, and on initialisation of the 64-bit variable. And if needs must, it could even be a compiled-in value, seeing it will only change once in every 68 years.

[+] touchpadder|3 years ago|reply
There's nothing ambiguous when the epoch is known and the previous one is long gone. So you're confused about restarting a timer every 50 years, ok.

It's not true that it's much simpler to work with two 32bit words for a date than working with simply restarted clock. Basic arithmetics cannot be used reliably so every operation must go through a library like i.e. bigint used to require. This complicates the system and the goal of having a reliable 32bit date format in the future is for simplicity.

[+] fargle|3 years ago|reply
here's an idea: instead of projecting a human concept of the roundness of a date onto the technical solution, let's use a value optimized for efficient implementation.

Obviously if you move toward 64 bits, as most systems have already done, you don't have a problem.

So if you want to stick to signed 32 bits, let's instead agree to restart counting 32 bit UNIX timestamps for the new epoch at exactly Sun Feb 7 06:28:16 AM 2106 UTC.

Sure, it's not a very round number in human terms, but has the advantage of requiring significantly less implementation.

Of course you still have the same problem of knowing which epoch you are in, but that's intrinsic to the problem when you only have 32 bits.

[+] touchpadder|3 years ago|reply
How does it require less implementation? It's just another arbitrary point in time and 2106 is too late.
[+] tobinfekkes|3 years ago|reply
And why not 2000 while you're at it, to keep it even?
[+] touchpadder|3 years ago|reply
Starting a new epoch every 50 years is kind of round and leaves plenty of space in between. 1970 is epoch 1, so this one will be epoch 2 and the next one in 2070 will be epoch 3 etc. It will be easy in a few hundred years to know which epoch is the current one. 2020 not 2000 for backwards compatibility to keep the intervals even for the new epochs, because the first one is already baked everywhere so we can't switch it to 1950.
[+] bell-cot|3 years ago|reply
Great idea - for shiny new systems, at new companies, that will never see any date older than Jan 1 2020.

But for other use cases - not so great.

[+] touchpadder|3 years ago|reply
For purposes that require looking far into the future or the past we already have ubiquitous 64 bit computers. The goal is to be able to fit the measure of time in 32bits in a standard way even after year 38 to have an alternative to using only 64bit time. 32 bits can only fit so many seconds so the clock must be restarted from time to time. The idea is to have a new 32 bit epoch every 50 years.
[+] victorbjorklund|3 years ago|reply
Why?
[+] touchpadder|3 years ago|reply
We're slowly running out of time in 32 bits. It would be good to have another standard measure of time that fits in 32 bits and is agreed upon long before the old one expires