浏览代码

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 年之前
父节点
当前提交
b1b17f286f
共有 1 个文件被更改,包括 1 次插入6 次删除
  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;