mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-25 22:03:45 -06:00
Core: POSIX GetSysTime and GetUtcTime now using threadsafe _r variants
git-svn-id: svn://ultimatepp.org/upp/trunk@2105 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
bcea643c67
commit
af6e2fa65f
1 changed files with 4 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue