2015-06-19 17:48:11 +00:00
|
|
|
--- a/src/time/__tz.c
|
|
|
|
+++ b/src/time/__tz.c
|
2022-04-10 22:11:51 +00:00
|
|
|
@@ -32,6 +32,9 @@ static int r0[5], r1[5];
|
2015-06-19 17:48:11 +00:00
|
|
|
static const unsigned char *zi, *trans, *index, *types, *abbrevs, *abbrevs_end;
|
|
|
|
static size_t map_size;
|
|
|
|
|
|
|
|
+static const char *tzfile;
|
|
|
|
+static size_t tzfile_size;
|
|
|
|
+
|
|
|
|
static char old_tz_buf[32];
|
|
|
|
static char *old_tz = old_tz_buf;
|
|
|
|
static size_t old_tz_size = sizeof old_tz_buf;
|
2022-04-10 22:11:51 +00:00
|
|
|
@@ -133,6 +136,15 @@ static void do_tzset()
|
2015-06-19 17:48:11 +00:00
|
|
|
"/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0";
|
|
|
|
|
|
|
|
s = getenv("TZ");
|
|
|
|
+
|
|
|
|
+ /* if TZ is empty try to read it from /etc/TZ */
|
|
|
|
+ if (!s || !*s) {
|
|
|
|
+ if (tzfile)
|
|
|
|
+ __munmap((void*)tzfile, tzfile_size);
|
|
|
|
+
|
|
|
|
+ s = tzfile = (void *)__map_file("/etc/TZ", &tzfile_size);
|
|
|
|
+ }
|
|
|
|
+
|
2015-07-24 15:35:55 +00:00
|
|
|
if (!s) s = "/etc/localtime";
|
2018-02-22 22:54:04 +00:00
|
|
|
if (!*s) s = __utc;
|
2015-06-19 17:48:11 +00:00
|
|
|
|