From b1b17f286f01667816f2ac00fc2c73fc43b561d8 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Mon, 17 Oct 2022 12:46:51 +0000 Subject: [PATCH] LibC: Retrieve the current time zone from LibTimeZone This ensures we have just one location for determining the time zone, so that LibC and LibTimeZone will behave the same. (Note the FIXME removed here is also in TimeZone::current_time_zone.) --- Userland/Libraries/LibC/time.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp index a1591c80512..2c93bcbe3dd 100644 --- a/Userland/Libraries/LibC/time.cpp +++ b/Userland/Libraries/LibC/time.cpp @@ -397,12 +397,7 @@ size_t strftime(char* destination, size_t max_size, char const* format, const st void tzset() { - // FIXME: Actually parse the TZ environment variable, described here: - // https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08 - if (char* tz = getenv("TZ"); tz != nullptr) - __tzname = { tz, strlen(tz) }; - else - __tzname = TimeZone::system_time_zone(); + __tzname = TimeZone::current_time_zone(); auto set_default_values = []() { timezone = 0;