I'm writing a piece of code that I want to work even past 2038. I need to store an epoch timestamp in a map and was wondering if I am compatible going forward when I use a long long
instead of an int
to store tiume(NULL)
or how else I best go about this? I'm aware that even using an unsigned int
would give nme plenty of more room - but is that or long long
the best way to go about it?
Asked
Active
Viewed 131 times
0

stdcerr
- 13,725
- 25
- 71
- 128
-
I checked this: https://en.wikipedia.org/wiki/Year_2038_problem, it will be a problem for 32-bit Linux/OS with 32-bit time_t, not for 64 bit linux/OS with 64-bit time_t. – dkb Jun 05 '18 at 05:11
-
do you also expect 32 bit systems to be around after 2038? – Arno Jun 05 '18 at 06:42
-
@Arno for sure they'll still be around! Consider that today, there are still a lot of 8bit systems around, too. Think embedded devices (not PCs)! Hence, `long long` will be 64 bit on either, 32 or 64bit systems... – stdcerr Jun 05 '18 at 13:45
-
@dkb yes, but the application needs to be written accordingly, too. `long long` will give me 64bit in any case. – stdcerr Jun 05 '18 at 13:46