cwTime.h/cpp : Added isLT() and isGT().
This commit is contained in:
parent
321182cd1d
commit
f8f21a9c0e
22
cwTime.cpp
22
cwTime.cpp
@ -105,6 +105,17 @@ bool cw::time::isLTE( const spec_t& t0, const spec_t& t1 )
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cw::time::isLT( const spec_t& t0, const spec_t& t1 )
|
||||
{
|
||||
if( t0.tv_sec < t1.tv_sec )
|
||||
return true;
|
||||
|
||||
if( t0.tv_sec == t1.tv_sec )
|
||||
return t0.tv_nsec < t1.tv_nsec;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cw::time::isGTE( const spec_t& t0, const spec_t& t1 )
|
||||
{
|
||||
if( t0.tv_sec > t1.tv_sec )
|
||||
@ -116,6 +127,17 @@ bool cw::time::isGTE( const spec_t& t0, const spec_t& t1 )
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cw::time::isGT( const spec_t& t0, const spec_t& t1 )
|
||||
{
|
||||
if( t0.tv_sec > t1.tv_sec )
|
||||
return true;
|
||||
|
||||
if( t0.tv_sec == t1.tv_sec )
|
||||
return t0.tv_nsec > t1.tv_nsec;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cw::time::isEqual( const spec_t& t0, const spec_t& t1 )
|
||||
{ return t0.tv_sec==t1.tv_sec && t0.tv_nsec==t1.tv_nsec; }
|
||||
|
||||
|
6
cwTime.h
6
cwTime.h
@ -42,9 +42,15 @@ namespace cw
|
||||
// Returns true if t0 <= t1.
|
||||
bool isLTE( const spec_t& t0, const spec_t& t1 );
|
||||
|
||||
// Returns true if t0 < t1.
|
||||
bool isLT( const spec_t& t0, const spec_t& t1 );
|
||||
|
||||
// Return true if t0 >= t1.
|
||||
bool isGTE( const spec_t& t0, const spec_t& t1 );
|
||||
|
||||
// Return true if t0 > t1.
|
||||
bool isGT( const spec_t& t0, const spec_t& t1 );
|
||||
|
||||
bool isEqual( const spec_t& t0, const spec_t& t1 );
|
||||
|
||||
bool isZero( const spec_t& t0 );
|
||||
|
Loading…
Reference in New Issue
Block a user