|
|
|
|
|
by fargle
1188 days ago
|
|
You miss the point. On Jan 19 2038 at 03:14:07 UTC, the very next second of a signed (2's complement) 32 bit time will roll over from +2^31-1 to -2^31. Which happens to be -2^31 seconds before Sun Feb 7 06:28:16 AM 2106 UTC. So if you were just to interpret those negative dates as relative to 2106, you are good to go in 2038 without changing anything. Any system of assigning epochs needs to have some method to determine which epoch you are referring to, so that's no different no matter if the scheme starts in 2020, 1970 2040, etc. So just use the natural modulus of 2^32 if you are using signed 2^32 to represent dates. When it rolls over, you're in a new epoch. I'm kind of trying to point out that if you have a calendar that repeats after every 2^32 seconds, and you have more than 2^32 seconds to count, your problem is that you have too small of a counter, not wherever the arbitrary start point is - changing that is silly and just adds complication. |
|
In 99.9% cases there will be no need to keep track of the epoch just like the current computers don't look before 1970. In rare cases if its required the epoch can obviously be stored in another byte.