From 0aaa6989c86eb6f15f49faee7ab0c013ebe89171 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 28 Jan 2019 11:13:32 +0100 Subject: Use reentrant gmtime and localtime functions, and other tweaks --- src/utils.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/utils.cpp') diff --git a/src/utils.cpp b/src/utils.cpp index be3cfd3..7a922fe 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -536,8 +536,9 @@ void printEnsemble(const shared_ptr& ensemble) if (ensemble->lto_auto) { time_t now = time(nullptr); - struct tm* ltime = localtime(&now); - time_t now2 = timegm(ltime); + struct tm ltime; + localtime_r(&now, <ime); + time_t now2 = timegm(<ime); etiLog.log(info, " lto: %2.1f hours", 0.5 * (now2 - now) / 1800); } else { -- cgit v1.2.3