This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

gmtime/localtime (time.h functions) work incorrectly in CCSv6

Expert 1140 points


Hi,

I just found out that the gmtime and localtime produce incorrect date based on the time_t value. The 1404337303 value stands for Wed Jul 2 21:41:43 2014.

The following code snippet:

time_t rawtime = 1404337303;
struct tm * timeinfo;
timeinfo = gmtime(&rawtime);
printf("===Current local time and date: %s", asctime(timeinfo));

produces incorrect date output in CCSv6:

===Current local time and date: Mon Jul  3 03:41:43 1944

while in the GCC it is:

==Current local time and date: Wed Jul  2 21:41:43 2014

Is there any workaround on this apart from not using time.h?

Best Regards,

tml