[riot-devel] Year 2038

Baptiste Clenet bapclenet at gmail.com
Thu Oct 29 15:03:48 CET 2015


Hi,

Most RIOT cpu use 32bit system or less, in 2038, 32bit system will get
an overflow if they use epoch system and it will comes back to year
1900.
How to avoid this problem, is there a solution with RIOT?

Example:
int date = 2147483649;
struct tm now;
now = *localtime((time_t*)&date);
printf("New date: day:%d month:%d year:%d Hour:%d  Min:%d  Sec:%d\n",
                                    now.tm_mday,
                                    now.tm_mon,
                                    1900 + now.tm_year,
                                    now.tm_hour,
                                    now.tm_min,
                                    now.tm_sec);

New date: day:13 month:11 year:1901 Hour:20  Min:45  Sec:53



-- 
Baptiste


More information about the devel mailing list