]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index/test-mail-index-transaction-update.c: Fix timzone offset check
authorKarl Fleischmann <karl.fleischmann@open-xchange.com>
Fri, 10 Jun 2022 13:44:52 +0000 (15:44 +0200)
committerKarl Fleischmann <karl.fleischmann@open-xchange.com>
Mon, 4 Jul 2022 09:53:48 +0000 (11:53 +0200)
The extern timezone variable is not standardized. This commit introduces
a more portable way of determining the UTC-offset by using the local
time.

src/lib-index/test-mail-index-transaction-update.c

index cdfa9511157aa44fbee54521cc177ccd0e155fee..632265025a14eec30ac955394450dacd2b191632 100644 (file)
@@ -6,6 +6,7 @@
 #include "test-common.h"
 #include "mail-index-private.h"
 #include "mail-index-transaction-private.h"
+#include "utc-offset.h"
 
 #include <time.h>
 
@@ -630,7 +631,9 @@ static void test_mail_index_update_day_first_uid(void)
 
        /* daylight savings times were confusing these tests, so we'll now
           just assume that TZ=UTC */
-       test_assert(timezone == 0);
+       time_t now = time(NULL);
+       struct tm *local_time = localtime(&now);
+       test_assert(utc_offset(local_time, now) == 0);
 
        hdr.messages_count = 10;
        t = mail_index_transaction_new();