From af6e2fa65fdf5faadee3155571d28e875dd220cd Mon Sep 17 00:00:00 2001 From: cxl Date: Sat, 20 Feb 2010 16:24:19 +0000 Subject: [PATCH] Core: POSIX GetSysTime and GetUtcTime now using threadsafe _r variants git-svn-id: svn://ultimatepp.org/upp/trunk@2105 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/TimeDate.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/uppsrc/Core/TimeDate.cpp b/uppsrc/Core/TimeDate.cpp index 1abb033f5..cacbfbbc6 100644 --- a/uppsrc/Core/TimeDate.cpp +++ b/uppsrc/Core/TimeDate.cpp @@ -343,7 +343,8 @@ FileTime Time::AsFileTime() const { #ifdef PLATFORM_POSIX Time::Time(FileTime filetime) { - struct tm *time = localtime(&filetime.ft); + struct tm time_r; + struct tm *time = localtime_r(&filetime.ft, &time_r); if(time) *this = Time(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec); @@ -446,7 +447,8 @@ Time GetSysTime() { Time GetUtcTime() { time_t gmt = time(NULL); - struct tm *utc = gmtime(&gmt); + struct tm timer; + struct tm *utc = gmtime_r(&gmt, &timer); return Time(utc->tm_year + 1900, utc->tm_mon + 1, utc->tm_mday, utc->tm_hour, utc->tm_min, utc->tm_sec); }