3 ms·
Applications that would have difficulty moving to a 64-bit time_t, typically for object-size and alignment in legacy protocols, can often be recompiled to use a
by ncmncm 6y ago
Applications that would have difficulty moving to a 64-bit time_t, typically for object-size and alignment in legacy protocols, can often be recompiled to use an unsigned 32-bit value there, taking them up into 2106. So, a 32-bit kernel, typically forked from 2.6 or 3.x and with unsigned 32-bit time_t, is a viable alternative for rescuing legacy embedded uses.
Probably by 2106 the machines will be responsible for coding, and it will then be their problem; or, civilization might collapse, so any people remaining will have bigger worries. Or (best case) both.
- saurik 6y agoI think a core problem is that merely changing the type and recompiling it is likely to cause other issues with code that is using time_t--for right or for wrong--to store the result of subtracting two other time_t values; it also could easily be that a piece of software just sort of looks like it works after that edit but doesn't die to some less-used corner case. (And, FWIW: my expectation is that civilization will have collapsed because of the machines taking over, and the only thing that will save humanity is when they all keel over and die on February 7, 2106.)
- hakfoo 6y agoWhy isn't moving the epoch a reasonable option? You go through and subtract 50 years from all date values you have in storage, change the date display code to show everything based on 2020, and you've kicked the can on the problem down to 2088.
- jabl 6y agoBecause you're breaking backwards compatibility by changing the interpretation of those timestamp fields. If you do that, you might as well switch to a 64-bit time_t. Treating a 32-bit timestamp field as unsigned seconds since the epoch at least keeps backwards compatibility with existing software up until 2038.
- jabl 6y agoFor handling legacy protocols and file formats, can't you just use uint32_t for the timestamp, and then convert that to time_t for the in-memory representation. No need to fork the kernel. That's probably what you needed to do anyway, if you want the code to compile correctly on systems with 32 and 64-bit time_t.