use localtime_r

fix off-by-one errors in time output
This commit is contained in:
Glenn Maynard
2004-02-22 23:39:11 +00:00
parent 06c9073fcf
commit 1208c42c4d
+5 -7
View File
@@ -125,14 +125,12 @@ RageLog::RageLog()
time_t cur_time; time_t cur_time;
time(&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+1, now.tm_mday, now.tm_hour+1, now.tm_min, now.tm_sec );
this->Info( "Log starting %.4d-%.2d-%.2d %.2d:%.2d:%.2d", this->Trace( " " );
1900+now->tm_year, now->tm_mon, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec );
this->Trace( " " );
}
} }
RageLog::~RageLog() RageLog::~RageLog()