From a5fbbd2fca0c8cd2a3c0c9a898dca37addf4b2e0 Mon Sep 17 00:00:00 2001 From: Matej Marusak Date: Thu, 6 Dec 2018 11:59:56 +0100 Subject: [PATCH 2/2] lib: Explicitly do not use DST DST = Daylight Saving Time Value of this field is not set up by strptime and therefore value of `tm_isdst` field is undefined. Bacause of this reason, output of `mktime` may differ +-1 hour. Signed-off-by: Matej Marusak (cherry picked from commit bd7b93d056d780df18b377f5c553611deeff2443) --- src/lib/iso_date_string.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/iso_date_string.c b/src/lib/iso_date_string.c index ab23f05b..cb887832 100644 --- a/src/lib/iso_date_string.c +++ b/src/lib/iso_date_string.c @@ -61,6 +61,9 @@ int iso_date_string_parse(const char *date, time_t *pt) return -EINVAL; } + // daylight saving time not in use + local.tm_isdst = 0; + *pt = mktime(&local); return 0; } -- 2.21.0