summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-10-17 12:41:19 +0000
committerLinus Groh <mail@linusgroh.de>2022-10-17 21:50:55 +0200
commited612d835db151b4a69d1ec3640d00ed9a9a1077 (patch)
tree9ce4aad8e660f88451746128dd003758cbd0a9ad /Userland
parent6691ef5a4482673c8031c3bb1d027e609e1b4b6c (diff)
downloadserenity-ed612d835db151b4a69d1ec3640d00ed9a9a1077.zip
LibTimeZone: Default to UTC if parsing the TZ environment variable fails
Commit c3fd455 changed LibTimeZone to fall back to the system time zone when we fail to parse the TZ environment variable. This behavior differs from both our LibC and glibc; they abort parsing and default to UTC. This changes LibTimeZone to behave the same way to avoid a very awkward situation where some parts of the codebase thinks the timezone is UTC, and others think the timezone is whatever /etc/timezone indicates.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibTimeZone/TimeZone.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibTimeZone/TimeZone.cpp b/Userland/Libraries/LibTimeZone/TimeZone.cpp
index 4bc21a27d7..8d3107586a 100644
--- a/Userland/Libraries/LibTimeZone/TimeZone.cpp
+++ b/Userland/Libraries/LibTimeZone/TimeZone.cpp
@@ -99,6 +99,7 @@ StringView current_time_zone()
return *maybe_time_zone;
dbgln_if(TIME_ZONE_DEBUG, "Could not determine time zone from TZ environment: {}", time_zone);
+ return "UTC"sv;
}
#ifdef AK_OS_SERENITY