diff --git a/stepmania/src/DateTime.cpp b/stepmania/src/DateTime.cpp index 13c76c0d38..3357141df2 100644 --- a/stepmania/src/DateTime.cpp +++ b/stepmania/src/DateTime.cpp @@ -16,9 +16,18 @@ void DateTime::Init() DateTime DateTime::GetNowDateTime() { time_t now = time(NULL); - DateTime tNow; + tm tNow; localtime_r( &now, &tNow ); - return tNow; + DateTime dtNow; +#define COPY_M( v ) dtNow.v = tNow.v; + COPY_M( tm_year ); + COPY_M( tm_mon ); + COPY_M( tm_mday ); + COPY_M( tm_hour ); + COPY_M( tm_min ); + COPY_M( tm_sec ); +#undef COPY_M + return dtNow; } DateTime DateTime::GetNowDate() diff --git a/stepmania/src/DateTime.h b/stepmania/src/DateTime.h index 73ec40ad6f..3d5051ffc9 100644 --- a/stepmania/src/DateTime.h +++ b/stepmania/src/DateTime.h @@ -25,14 +25,21 @@ tm GetNextSunday( tm start ); tm GetDayInYearAndYear( int iDayInYearIndex, int iYear ); -struct DateTime : public tm +struct DateTime { + int tm_sec; /* seconds after the minute - [0,59] */ + int tm_min; /* minutes after the hour - [0,59] */ + int tm_hour; /* hours since midnight - [0,23] */ + int tm_mday; /* day of the month - [1,31] */ + int tm_mon; /* months since January - [0,11] */ + int tm_year; /* years since 1900 */ + DateTime(); void Init(); bool operator<( const DateTime& other ) const { - #define COMPARE( v ) if(v!=other.v) return vother.v) return false; COMPARE( tm_year ); COMPARE( tm_mon ); COMPARE( tm_mday ); @@ -41,7 +48,7 @@ struct DateTime : public tm COMPARE( tm_sec ); #undef COMPARE // they're equal - return true; + return false; } bool operator==( const DateTime& other ) const {