From cd0e5ccd3f9c0f7d92e140c332700ccde41b396a Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Mon, 24 Jan 2022 15:26:11 -0500 Subject: 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. --- Userland/Libraries/LibC/time.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'Userland/Libraries/LibC/time.cpp') diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp index cf99be868a..728c01a075 100644 --- a/Userland/Libraries/LibC/time.cpp +++ b/Userland/Libraries/LibC/time.cpp @@ -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; } -- cgit v1.2.3