diff --git a/src/DateTime.cpp b/src/DateTime.cpp index 02eb91f636..ba69d02f03 100644 --- a/src/DateTime.cpp +++ b/src/DateTime.cpp @@ -42,6 +42,20 @@ bool DateTime::operator==( const DateTime& other ) const return true; } +bool DateTime::operator>( const DateTime& other ) const +{ +#define COMPARE( v ) if(v!=other.v) return v>other.v; + COMPARE( tm_year ); + COMPARE( tm_mon ); + COMPARE( tm_mday ); + COMPARE( tm_hour ); + COMPARE( tm_min ); + COMPARE( tm_sec ); +#undef COMPARE + // they're equal + return false; +} + DateTime DateTime::GetNowDateTime() { time_t now = time(NULL); diff --git a/src/DateTime.h b/src/DateTime.h index c0d0fac6d6..3fa1735bd0 100644 --- a/src/DateTime.h +++ b/src/DateTime.h @@ -45,6 +45,7 @@ struct DateTime void Init(); bool operator<( const DateTime& other ) const; + bool operator>( const DateTime& other ) const; bool operator==( const DateTime& other ) const; bool operator!=( const DateTime& other ) const { return !operator==(other); }