pull code out of header

This commit is contained in:
Glenn Maynard
2005-08-12 03:22:44 +00:00
parent ca72464405
commit fbfafcecbb
2 changed files with 29 additions and 25 deletions
+27
View File
@@ -14,6 +14,33 @@ void DateTime::Init()
ZERO( *this ); ZERO( *this );
} }
bool DateTime::operator<( const DateTime& other ) const
{
#define COMPARE( v ) if(v<other.v) return true; if(v>other.v) return false;
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;
}
bool DateTime::operator==( const DateTime& other ) const
{
#define COMPARE(x) if( x!=other.x ) return false;
COMPARE( tm_year );
COMPARE( tm_mon );
COMPARE( tm_mday );
COMPARE( tm_hour );
COMPARE( tm_min );
COMPARE( tm_sec );
#undef COMPARE
return true;
}
DateTime DateTime::GetNowDateTime() DateTime DateTime::GetNowDateTime()
{ {
time_t now = time(NULL); time_t now = time(NULL);
+2 -25
View File
@@ -41,31 +41,8 @@ struct DateTime
DateTime(); DateTime();
void Init(); void Init();
bool operator<( const DateTime& other ) const bool operator<( const DateTime& other ) const;
{ bool operator==( const DateTime& other ) const;
#define COMPARE( v ) if(v<other.v) return true; if(v>other.v) return false;
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;
}
bool operator==( const DateTime& other ) const
{
#define COMPARE(x) if( x!=other.x ) return false;
COMPARE( tm_year );
COMPARE( tm_mon );
COMPARE( tm_mday );
COMPARE( tm_hour );
COMPARE( tm_min );
COMPARE( tm_sec );
#undef COMPARE
return true;
}
bool operator!=( const DateTime& other ) const { return !operator==(other); } bool operator!=( const DateTime& other ) const { return !operator==(other); }
static DateTime GetNowDateTime(); static DateTime GetNowDateTime();