4 ms·
Unsigned integers will get you going till the year 2106, that could be an easy hotfix if you don't have to store datetimes before 1970. Using 64-bit integers i
by lucb1e 14y ago
Unsigned integers will get you going till the year 2106, that could be an easy hotfix if you don't have to store datetimes before 1970.
Using 64-bit integers is overkill, they will work till the year 584bln[1] and it's twice as much data for every timestamp. Adding one byte (5-byte integers) is uncommon, but that supports the year 36000 already, so it would be more than enough.
[1] In full, till the year 584 942 419 325.
- lucian1900 14y agoIt's not like timestamps are very common in memory. And having them aligned would possibly be more valuable than a small reduction in memory.
- swombat 14y agoFor the comic symmetry of the universe, I hope some digital archeologist picks up this comment in 3599 and curses us under his breath.
- thomasahle 14y agoOr define your 64bit timestamp to be in nanoseconds, in which case it will only last till year 2555.
- masklinn 14y ago> Using 64-bit integers is overkill, they will work till the year 584bln[1] Yes because we have so little memory and so many timestamps to store that scrounging on the size of timestamps is highly important and absolutely not something which has been a pain in the ass half a dozen times in the short lifespan of computers. Wait, we don't and it has.
- FigBug 14y agoMost languages don't have 5 byte types. Even if you make a struct with a 32bit int and an 8bit int it's get padded to 64bits. Additional complexity for no savings.
- otikik 14y ago640kB ought to be enough for everyone, right.
- Dewie 14y ago32 bit integers are probably the most commonly used size for integers in contemporary programming, even though they seldom will need anything near that kind of capacity. Is it really necessary to be a miser with memory when it comes to this?
- PavlovsCat 14y agoI don't mind doubling the size that much, but why not have milliseconds instead of seconds? 500+ billion years is just silly.. 500 million years ought to be enough for any civilization.
- ygra 14y agoWindows uses 100-ns intervals since 1601 (start of the current 400-year cycle of the Gregorian calendar at the point where NT was designed) which offers good accuracy and should last for the foreseeable future.