diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2010-01-08 23:22:42 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-05 17:17:43 +0100 |
commit | 9b21ae4db81188587dcdbc53f2cc1cdc432e8196 (patch) | |
tree | 9a56e732f90cbae0354394aa93f305501ba25819 /src | |
parent | c02151f78b732c49f2ccb138860f5eec3da3a602 (diff) | |
download | usdx-9b21ae4db81188587dcdbc53f2cc1cdc432e8196.tar.gz usdx-9b21ae4db81188587dcdbc53f2cc1cdc432e8196.tar.xz usdx-9b21ae4db81188587dcdbc53f2cc1cdc432e8196.zip |
make localtime threadsafe using localtime_r
Diffstat (limited to 'src')
-rw-r--r-- | src/base/database.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
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; } } |