1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

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.
This commit is contained in:
Timothy Flynn 2022-10-17 12:41:19 +00:00 committed by Linus Groh
parent 6691ef5a44
commit ed612d835d
2 changed files with 27 additions and 0 deletions

View file

@ -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