From: Mikko Rasa Date: Fri, 26 Nov 2010 12:59:20 +0000 (+0000) Subject: Make to_unixtime const X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=efa772f72195ab4aaf7dfb880e27bf0e07195d65;p=libs%2Fcore.git Make to_unixtime const Add fill_timeval method --- diff --git a/source/time/timedelta.h b/source/time/timedelta.h index 26da8f4..a601f8d 100644 --- a/source/time/timedelta.h +++ b/source/time/timedelta.h @@ -9,6 +9,7 @@ Distributed under the LGPL #define MSP_TIME_TIMEDELTA_H_ #include +#include #include #include "types.h" @@ -48,6 +49,8 @@ public: 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; } + + void fill_timeval(timeval &tv) const { tv.tv_sec=usec/1000000; tv.tv_usec=usec%1000000; } #endif TimeDelta operator+(const TimeDelta &t) const { return TimeDelta(usec+t.usec); } diff --git a/source/time/timestamp.h b/source/time/timestamp.h index db3587a..64309ce 100644 --- a/source/time/timestamp.h +++ b/source/time/timestamp.h @@ -44,7 +44,7 @@ public: */ RawTime raw() const { return usec; } - time_t to_unixtime() { return usec/1000000LL; } + time_t to_unixtime() const { return usec/1000000LL; } TimeStamp operator+(const TimeDelta &t) const { return TimeStamp(usec+t.raw()); } TimeStamp &operator+=(const TimeDelta &t) { usec+=t.raw(); return *this; }