summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/time.cpp
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-01-24 15:26:11 -0500
committerLinus Groh <mail@linusgroh.de>2022-01-25 18:39:36 +0000
commitcd0e5ccd3f9c0f7d92e140c332700ccde41b396a (patch)
treefb572c2968def5292a5019166e8f91789a53774e /Userland/Libraries/LibC/time.cpp
parent11f1f04a4ccc2bc03f6180dfbe9dd553c5706c9a (diff)
downloadserenity-cd0e5ccd3f9c0f7d92e140c332700ccde41b396a.zip
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.
Diffstat (limited to 'Userland/Libraries/LibC/time.cpp')
-rw-r--r--Userland/Libraries/LibC/time.cpp8
1 files changed, 1 insertions, 7 deletions
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;
}