minmea_gettimeofday: workaround missing tm_isdst on some systems

This commit is contained in:
Kosma Moczek 2014-05-28 16:06:32 +02:00
parent 03d9772807
commit c5bc12f8cc

View File

@ -493,15 +493,15 @@ int minmea_gettimeofday(struct timeval *tv, const struct minmea_date *date, cons
return -1;
struct tm tm;
memset(&tm, 0, sizeof(tm));
tm.tm_year = 2000 + date->year - 1900;
tm.tm_mon = date->month - 1;
tm.tm_mday = date->day;
tm.tm_hour = time->hours;
tm.tm_min = time->minutes;
tm.tm_sec = time->seconds;
tm.tm_isdst = 0;
time_t timestamp = timegm(&tm);
time_t timestamp = timegm(&tm);
if (timestamp != -1) {
tv->tv_sec = timestamp;
tv->tv_usec = time->microseconds;