Browse Source

minmea_gettimeofday: workaround missing tm_isdst on some systems

Kosma Moczek 11 years ago
parent
commit
c5bc12f8cc
1 changed files with 2 additions and 2 deletions
  1. 2 2
      minmea.c

+ 2 - 2
minmea.c

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