Tool/software: TI C/C++ Compiler
Hello,
I hope I'm asking on the right forum.
My problem is with the standard "time.h" library, specifically with gmtime() function.
Basically I retrieve NTP timestamp from the internet and want to convert it into a time structure using gmtime(). The conversion is successful, but the time I'm getting is always GMT + 6 hours. My question is why it is shifted by 6 hours? Am I missing something?
My code is:
time_t cur_time;
struct tm *tm_time;
cur_time = GetNTPTime(); // Getting NTP time from the Internet (my own function)
tm_time = gmtime(&cur_time); // Converting NTP time to a time structure
UART_PRINT("%s\n", asctime(tm_time)); // print the time as a string
I was getting: Tue Jan 17 23:06:04 2017, but the correct GMT time was actually: Tue Jan 17 17:06:04 2017
I'm using TIv15.12.3LTS compiler.
I will appreciate any suggestions.
Thank you
Daniel