]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/timeutils: set TZ=GMT for unit test
authorKarel Zak <kzak@redhat.com>
Tue, 24 Jan 2023 15:42:42 +0000 (16:42 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 24 Jan 2023 15:42:42 +0000 (16:42 +0100)
It seems better to explicitly set timezone rather than assume some
default libc behavior and system setting.

Addresses: https://github.com/util-linux/util-linux/pull/2025
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/timeutils.c

index f61a77ab950acd5c3d28e9953737576e00f1db56..7e4855b692a42ccb71b2681da4b396b263e3bf90 100644 (file)
@@ -646,8 +646,7 @@ static int run_unittest_timestamp(void)
                { "20120922163422"         , 1348331662000000 },
        };
 
-       if (unsetenv("TZ"))
-               rc = EXIT_FAILURE;
+       setenv("TZ", "GMT", 1);
        tzset();
 
        for (size_t i = 0; i < ARRAY_SIZE(testcases); i++) {