Localtime to Localtime_s
I'm having issues converting my local time. Can anyone tell me what I'm doing wrong
My code when I got the localtime error
1 2 3 4 5
|
time_t tm = m_Flight.dateStamp;
struct tm t = *localtime(&tm);
char buf[80];
strftime(buf, sizeof(buf), "%a, %d %b %Y %H: %M: %S", &t);
return string(buf);
|
I tried the following
1 2 3 4 5 6
|
time_t tm = m_Flight.dateStamp;
struct tm t;
localtime_s(&tm, &t);
char buf[80];
strftime(buf, sizeof(buf), "%a, %d %b %Y %H: %M: %S", &t);
return string(buf);
|
What sort of error are you getting?
Topic archived. No new replies allowed.