Selaa lähdekoodia

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.)
Timothy Flynn 2 vuotta sitten
vanhempi
commit
b1b17f286f
1 muutettua tiedostoa jossa 1 lisäystä ja 6 poistoa
  1. 1 6
      Userland/Libraries/LibC/time.cpp

+ 1 - 6
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;