- /**
- Constructs a zero TimeDelta.
- */
- TimeDelta(): usec(0) { }
-
- /**
- Constructs a TimeDelta from a plain number. The purpose of this is to allow
- serialization together with the raw() function. For creating TimeDeltas
- with a specific length, see units.h.
- */
- explicit TimeDelta(int64_t u): usec(u) { }
-
- /**
- Returns the raw number stored inside the TimeDelta. This should only be used
- for serialization and the result should not be interpreted in any way.
- */
- int64_t raw() const { return usec; }
-
- /**
- Fills in a timespec struct. To get a meaningful scalar value from the
- TimeDelta, divide with one of the values in units.h.
- */
- void fill_timespec(timespec &ts) const { ts.tv_sec=usec/1000000; ts.tv_nsec=(usec%1000000)*1000; }
-
- TimeDelta operator+(const TimeDelta &t) const { return TimeDelta(usec+t.usec); }
- TimeDelta &operator+=(const TimeDelta &t) { usec+=t.usec; return *this; }
- TimeDelta operator-(const TimeDelta &t) const { return TimeDelta(usec-t.usec); }
- TimeDelta &operator-=(const TimeDelta &t) { usec-=t.usec; return *this; }
+ /** Constructs a zero TimeDelta. */
+ TimeDelta() = default;
+
+ /** Constructs a TimeDelta from a plain number. The purpose of this is to
+ allow serialization together with the raw() function. */
+ explicit TimeDelta(RawTime u): usec(u) { }
+
+ /** Returns the raw number stored inside the TimeDelta. This should only be used
+ for serialization and the result should not be interpreted in any way. */
+ RawTime raw() const { return usec; }
+
+ TimeDelta operator+(const TimeDelta &t) const { return TimeDelta(usec+t.usec); }
+ TimeDelta &operator+=(const TimeDelta &t) { usec += t.usec; return *this; }
+ TimeDelta operator-(const TimeDelta &t) const { return TimeDelta(usec-t.usec); }
+ TimeDelta &operator-=(const TimeDelta &t) { usec -= t.usec; return *this; }
+ TimeDelta operator-() const { return TimeDelta(-usec); }