From 1208c42c4dcd73a95c6b32b09239c49f3b39fc9e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 22 Feb 2004 23:39:11 +0000 Subject: [PATCH] use localtime_r fix off-by-one errors in time output --- stepmania/src/RageLog.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/stepmania/src/RageLog.cpp b/stepmania/src/RageLog.cpp index 40bb4918e7..ae1f32e0ed 100644 --- a/stepmania/src/RageLog.cpp +++ b/stepmania/src/RageLog.cpp @@ -125,14 +125,12 @@ RageLog::RageLog() time_t cur_time; time(&cur_time); - const struct tm *now = localtime(&cur_time); + struct tm now; + localtime_r( &cur_time, &now ); - if ( now ) - { - this->Info( "Log starting %.4d-%.2d-%.2d %.2d:%.2d:%.2d", - 1900+now->tm_year, now->tm_mon, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec ); - this->Trace( " " ); - } + this->Info( "Log starting %.4d-%.2d-%.2d %.2d:%.2d:%.2d", + 1900+now.tm_year, now.tm_mon+1, now.tm_mday, now.tm_hour+1, now.tm_min, now.tm_sec ); + this->Trace( " " ); } RageLog::~RageLog()