From f5331cdef386fbcc99a85c8e932a477896869d69 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 3 Aug 2021 13:04:46 -0700 Subject: [PATCH] Use localtime_r instead of localtime --- daemon/x52d_clock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/x52d_clock.c b/daemon/x52d_clock.c index 0958502..6961fe8 100644 --- a/daemon/x52d_clock.c +++ b/daemon/x52d_clock.c @@ -42,6 +42,7 @@ static int get_tz_offset(const char *tz) char *orig_tz = NULL; char *orig_tz_copy = NULL; time_t t; + struct tm tmp; struct tm *timeval; char *new_tz = NULL; size_t new_tz_len; @@ -67,7 +68,7 @@ static int get_tz_offset(const char *tz) setenv("TZ", new_tz, true); t = time(NULL); - timeval = localtime(&t); + timeval = localtime_r(&t, &tmp); if (timeval != NULL) { #if HAVE_STRUCT_TM_TM_GMTOFF /* If valid, then timeval.tm_gmtoff contains the offset in seconds east