mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-15 14:02:20 +00:00
LibC: Revert localtime_r to use time zone information set by tzset
Now that tzset actually detects time zones, parties interested in time zone offsets should invoke tzset.
This commit is contained in:
parent
11f1f04a4c
commit
cd0e5ccd3f
Notes:
sideshowbarker
2024-07-17 20:15:31 +09:00
Author: https://github.com/trflynn89
Commit: cd0e5ccd3f
Pull-request: https://github.com/SerenityOS/serenity/pull/12119
Reviewed-by: https://github.com/linusg ✅
1 changed files with 1 additions and 7 deletions
|
@ -162,13 +162,7 @@ struct tm* localtime_r(const time_t* t, struct tm* tm)
|
|||
if (!t)
|
||||
return nullptr;
|
||||
|
||||
auto time_zone = TimeZone::current_time_zone();
|
||||
auto time = AK::Time::from_seconds(*t);
|
||||
|
||||
if (auto offset = TimeZone::get_time_zone_offset(time_zone, time); offset.has_value())
|
||||
time += AK::Time::from_seconds(offset->seconds);
|
||||
|
||||
time_to_tm(tm, time.to_seconds());
|
||||
time_to_tm(tm, *t - timezone);
|
||||
return tm;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue