]> git.ipfire.org Git - location/libloc.git/commitdiff
Fix timezone-dependant interpretation of database timestamp
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 Jun 2020 14:33:48 +0000 (14:33 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 Jun 2020 14:33:48 +0000 (14:33 +0000)
The timestamp that is retrieved from DNS is in UTC and we must
not interpret as local time.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/resolv.c

index 261ae5ce2932cd650f4008f89d77150f41263a15..e42e9de3e7673fb119236eecd4442af90d2d6add 100644 (file)
@@ -32,7 +32,7 @@ static int parse_timestamp(const unsigned char* txt, time_t* t) {
 
     // If the whole string has been parsed, we convert the parse value to time_t
     if (p && !*p) {
-        *t = mktime(&ts);
+        *t = timegm(&ts);
 
     // Otherwise we reset t
     } else {