From 8dd4e2b6c8b99952296319a0e0c0e0f3e6160e32 Mon Sep 17 00:00:00 2001 From: cwalker Date: Fri, 1 Mar 2024 17:50:29 +0000 Subject: [PATCH 57/57] Fix uninitialized variable in nmea_scan_rmc Initialize the tm_isdst variable to ensure that mktime does not fail on recent versions of glibc. This change initializes tm_isdst to 0 for compatibility with UTC. Previously, a positive value in the uninitialized tm_isdst would cause mktime to fail and ts2phc would repeatedly log "invalid master time stamp". This resulted in intermittent synchronization errors. [commit 63fc1ef4fd5e5fc45dd4de3bf27920bb109a4357 upstream] Signed-off-by: cwalker --- nmea.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nmea.c b/nmea.c index dc865d0..d86d81c 100644 --- a/nmea.c +++ b/nmea.c @@ -157,6 +157,7 @@ static int nmea_scan_rmc(struct nmea_parser *np, struct nmea_rmc *result) } tm.tm_year += 100; tm.tm_mon--; + tm.tm_isdst = 0; result->ts.tv_sec = mktime(&tm); result->ts.tv_nsec = msec * 1000000UL; result->fix_valid = status == 'A' ? true : false; -- 2.30.2