diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-01-24 15:08:10 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-25 18:39:36 +0000 |
commit | 11f1f04a4ccc2bc03f6180dfbe9dd553c5706c9a (patch) | |
tree | 991dbbaa46c56ba987ec28cdb8498c3a4937efeb /Userland/Libraries/LibC/time.cpp | |
parent | b1ea585149ecd9663aae9607c1b1c508cc98aec2 (diff) | |
download | serenity-11f1f04a4ccc2bc03f6180dfbe9dd553c5706c9a.zip |
LibC: Invoke tzset from time functions required to update time zone info
From POSIX:
the ctime(), localtime(), mktime(), strftime(), and strftime_l()
functions are required to set timezone information as if by calling
tzset()
ctime is excluded here because it invokes localtime, so there's no need
to invoke tzset twice.
Diffstat (limited to 'Userland/Libraries/LibC/time.cpp')
-rw-r--r-- | Userland/Libraries/LibC/time.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp index 53cdd4d5c6..cf99be868a 100644 --- a/Userland/Libraries/LibC/time.cpp +++ b/Userland/Libraries/LibC/time.cpp @@ -145,11 +145,14 @@ static time_t tm_to_time(struct tm* tm, long timezone_adjust_seconds) time_t mktime(struct tm* tm) { + tzset(); return tm_to_time(tm, timezone); } struct tm* localtime(const time_t* t) { + tzset(); + static struct tm tm_buf; return localtime_r(t, &tm_buf); } @@ -209,6 +212,8 @@ char* asctime_r(const struct tm* tm, char* buffer) // FIXME: Some formats are not supported. size_t strftime(char* destination, size_t max_size, const char* format, const struct tm* tm) { + tzset(); + const char wday_short_names[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; |