Implement assignment by subtraction for time classes
This commit is contained in:
parent
7ca061fb03
commit
cde67a202c
1 changed files with 9 additions and 6 deletions
|
|
@ -23,6 +23,7 @@ namespace fc {
|
|||
friend bool operator<(const microseconds& a, const microseconds& b){ return a._count < b._count; }
|
||||
friend bool operator<=(const microseconds& a, const microseconds& b){ return a._count <= b._count; }
|
||||
microseconds& operator+=(const microseconds& c) { _count += c._count; return *this; }
|
||||
microseconds& operator-=(const microseconds& c) { _count -= c._count; return *this; }
|
||||
int64_t count()const { return _count; }
|
||||
private:
|
||||
friend class time_point;
|
||||
|
|
@ -53,6 +54,7 @@ namespace fc {
|
|||
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; }
|
||||
time_point& operator += ( const microseconds& m) { elapsed+=m; return *this; }
|
||||
time_point& operator -= ( const microseconds& m) { elapsed-=m; return *this; }
|
||||
time_point operator + (const microseconds& m) const { return time_point(elapsed+m); }
|
||||
time_point operator - (const microseconds& m) const { return time_point(elapsed-m); }
|
||||
microseconds operator - (const time_point& m) const { return microseconds(elapsed.count() - m.elapsed.count()); }
|
||||
|
|
@ -90,6 +92,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; }
|
||||
time_point_sec& operator += ( uint32_t m ) { utc_seconds+=m; return *this; }
|
||||
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; }
|
||||
friend microseconds operator - ( const time_point_sec& t, const time_point_sec& m ) { return time_point(t) - time_point(m); }
|
||||
|
|
|
|||
Loading…
Reference in a new issue