adding helper methods

This commit is contained in:
Daniel Larimer 2014-04-27 21:20:40 -04:00
parent 07affde1f2
commit 6f466979cc

View file

@ -45,6 +45,7 @@ namespace fc {
static time_point from_iso_string( const fc::string& s );
const microseconds& time_since_epoch()const { return elapsed; }
uint32_t sec_since_epoch()const { return elapsed.count() / 1000000; }
bool operator > ( const time_point& t )const { return elapsed._count > t.elapsed._count; }
bool operator >=( const time_point& t )const { return elapsed._count >=t.elapsed._count; }
bool operator < ( const time_point& t )const { return elapsed._count < t.elapsed._count; }
@ -87,6 +88,7 @@ namespace fc {
friend bool operator <= ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds <= b.utc_seconds; }
friend bool operator >= ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds >= b.utc_seconds; }
friend bool operator == ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds == b.utc_seconds; }
friend bool operator != ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds != b.utc_seconds; }
time_point_sec& operator += ( uint32_t m ) { utc_seconds+=m; return *this; }
friend time_point operator - ( const time_point_sec& t, const microseconds& m ) { return time_point(t) - m; }