From c5bc12f8cc303754a04ff6991503f8dc5f70cd7c Mon Sep 17 00:00:00 2001 From: Kosma Moczek Date: Wed, 28 May 2014 16:06:32 +0200 Subject: [PATCH] minmea_gettimeofday: workaround missing tm_isdst on some systems --- minmea.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/minmea.c b/minmea.c index a005c97..584880c 100644 --- a/minmea.c +++ b/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;