From 29aa8373d4a18114b9a85a31a33683396a76e239 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 11 Feb 2020 19:36:59 +0100 Subject: [PATCH] LibC: Add localtime_r() --- Libraries/LibC/time.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/LibC/time.cpp b/Libraries/LibC/time.cpp index b505ed37ec..e56a77c3b7 100644 --- a/Libraries/LibC/time.cpp +++ b/Libraries/LibC/time.cpp @@ -118,8 +118,7 @@ struct tm* localtime(const time_t* t) if (!t) return nullptr; static struct tm tm_buf; - time_to_tm(&tm_buf, *t); - return &tm_buf; + return localtime_r(t, &tm_buf); } struct tm* gmtime(const time_t* t) @@ -180,8 +179,9 @@ struct tm* gmtime_r(const time_t*, struct tm*) ASSERT_NOT_REACHED(); } -struct tm* localtime_r(const time_t*, struct tm*) +struct tm* localtime_r(const time_t* t, struct tm* tm) { - ASSERT_NOT_REACHED(); + time_to_tm(tm, *t); + return tm; } }