Эх сурвалжийг харах

minmea_gettimeofday: workaround missing tm_isdst on some systems

Kosma Moczek 11 жил өмнө
parent
commit
c5bc12f8cc
1 өөрчлөгдсөн 2 нэмэгдсэн , 2 устгасан
  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;
 
     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;