mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
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.
This commit is contained in:
parent
b1ea585149
commit
11f1f04a4c
Notes:
sideshowbarker
2024-07-17 20:15:35 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/11f1f04a4cc Pull-request: https://github.com/SerenityOS/serenity/pull/12119 Reviewed-by: https://github.com/linusg ✅
|
@ -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"
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue