aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2010-01-08 23:22:42 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:43 +0100
commit9b21ae4db81188587dcdbc53f2cc1cdc432e8196 (patch)
tree9a56e732f90cbae0354394aa93f305501ba25819 /src
parentc02151f78b732c49f2ccb138860f5eec3da3a602 (diff)
downloadusdx-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.cpp7
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(&timestamp);
- if (tmp) {
- strftime(time, max, "%d.%m.%y" /* TODO: Language.Translate("STAT_FORMAT_DATE")*/, tmp);
+ struct tm tmp;
+
+ if (localtime_r(&timestamp, &tmp)) {
+ strftime(time, max, "%d.%m.%y" /* TODO: Language.Translate("STAT_FORMAT_DATE")*/, &tmp);
return time;
}
}