From 73fb8efeefc3ebdc8f5f04cecd3a4e7ef71fde20 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 24 Jan 2023 16:42:42 +0100 Subject: [PATCH] lib/timeutils: set TZ=GMT for unit test 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 --- lib/timeutils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/timeutils.c b/lib/timeutils.c index f61a77ab95..7e4855b692 100644 --- a/lib/timeutils.c +++ b/lib/timeutils.c @@ -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++) { -- 2.47.2