+ /** @return the saved seconds of this time stamp */
+ const sec_type& getSeconds() const
+ { return _sec; }
+ /** @return the saved nanoseconds of this time stamp */
+ const nsec_type& getNanoSeconds() const
+ { return _nsec; }
+
+ /** @return the value of the timestamp in nanoseconds,
+ * 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 toNSecs() const
+ { return _nsec + double(_sec)*1000*1000*1000; }
+
+ /** @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;
+ }