From aada5fd3dc351d19b9b7deaa394cdfce3f1f4ea2 Mon Sep 17 00:00:00 2001 From: "Christian W. Zuckschwerdt" Date: Fri, 26 Jan 2018 11:40:53 +0100 Subject: [PATCH] use localtime_r instead of localtime --- src/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util.c b/src/util.c index 4bd4c62c..f0cdca4e 100644 --- a/src/util.c +++ b/src/util.c @@ -130,7 +130,7 @@ int byteParity(uint8_t inByte){ char* local_time_str(time_t time_secs, char *buf) { time_t etime; - struct tm *tm_info; + struct tm tm_info; if (time_secs == 0) { extern float sample_file_pos; @@ -143,9 +143,9 @@ char* local_time_str(time_t time_secs, char *buf) { etime = time_secs; } - tm_info = localtime(&etime); + localtime_r(&etime, &tm_info); - strftime(buf, LOCAL_TIME_BUFLEN, "%Y-%m-%d %H:%M:%S", tm_info); + strftime(buf, LOCAL_TIME_BUFLEN, "%Y-%m-%d %H:%M:%S", &tm_info); return buf; }