+ /** @return the value of the timestamp in microseconds,
+ * use doubles to avoid overflow.
+ * If you need real nanosecond accuracy for time differences, build up a
+ * SGTimeStamp reference time and compare SGTimeStamps directly.
+ */
+ double toUSecs() const
+ { return 1e-3*_nsec + double(_sec)*1000*1000; }
+
+ /** @return the value of the timestamp in milliseconds,
+ * use doubles to avoid overflow.
+ * If you need real nanosecond accuracy for time differences, build up a
+ * SGTimeStamp reference time and compare SGTimeStamps directly.
+ */
+ double toMSecs() const
+ { return 1e-6*_nsec + double(_sec)*1000; }
+
+ /** @return the value of the timestamp in seconds,
+ * use doubles to avoid overflow.
+ * If you need real nanosecond accuracy for time differences, build up a
+ * SGTimeStamp reference time and compare SGTimeStamps directly.
+ */
+ double toSecs() const
+ { return 1e-9*_nsec + _sec; }
+
+ /** Inplace addition.
+ */
+ SGTimeStamp& operator+=(const SGTimeStamp& c)
+ {
+ _sec += c._sec;
+ _nsec += c._nsec;
+ if ((1000*1000*1000) <= _nsec) {
+ _nsec -= (1000*1000*1000);
+ _sec += 1;
+ }
+ return *this;
+ }
+
+ /** Inplace subtraction.
+ */
+ SGTimeStamp& operator-=(const SGTimeStamp& c)
+ {
+ _sec -= c._sec;
+ _nsec -= c._nsec;
+ if (_nsec < 0) {
+ _nsec += (1000*1000*1000);
+ _sec -= 1;
+ }
+ return *this;
+ }