From 9b21ae4db81188587dcdbc53f2cc1cdc432e8196 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 8 Jan 2010 23:22:42 +0100 Subject: make localtime threadsafe using localtime_r --- src/base/database.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/base') diff --git a/src/base/database.cpp b/src/base/database.cpp index 0e1ba92d..8ff34a67 100644 --- a/src/base/database.cpp +++ b/src/base/database.cpp @@ -325,9 +325,10 @@ namespace usdx char* StatDatabase::format_date(char* time, size_t max, time_t timestamp) { if (timestamp != 0) { - struct tm *tmp = localtime(×tamp); - if (tmp) { - strftime(time, max, "%d.%m.%y" /* TODO: Language.Translate("STAT_FORMAT_DATE")*/, tmp); + struct tm tmp; + + if (localtime_r(×tamp, &tmp)) { + strftime(time, max, "%d.%m.%y" /* TODO: Language.Translate("STAT_FORMAT_DATE")*/, &tmp); return time; } } -- cgit v1.2.3