diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/include/qpid/sys/Time.h | 5 | ||||
-rw-r--r-- | cpp/src/qpid/sys/posix/Time.cpp | 2 | ||||
-rw-r--r-- | cpp/src/qpid/sys/windows/Time.cpp | 4 |
3 files changed, 10 insertions, 1 deletions
diff --git a/cpp/include/qpid/sys/Time.h b/cpp/include/qpid/sys/Time.h index ad05b0d1c7..bd6fe87ec8 100644 --- a/cpp/include/qpid/sys/Time.h +++ b/cpp/include/qpid/sys/Time.h @@ -88,13 +88,16 @@ class AbsTime { TimePrivate timepoint; public: - QPID_COMMON_EXTERN inline AbsTime() {} + + QPID_COMMON_EXTERN inline AbsTime() : timepoint() {} QPID_COMMON_EXTERN AbsTime(const AbsTime& time0, const Duration& duration); // Default assignment operation fine // Default copy constructor fine QPID_COMMON_EXTERN static AbsTime now(); QPID_COMMON_EXTERN static AbsTime FarFuture(); + QPID_COMMON_EXTERN static AbsTime epoch(); // The Unix epoch: 1970-01-01T00:00:00 + const TimePrivate& getPrivate(void) const { return timepoint; } bool operator==(const AbsTime& t) const { return t.timepoint == timepoint; } template <class S> void serialize(S& s) { s(timepoint); } diff --git a/cpp/src/qpid/sys/posix/Time.cpp b/cpp/src/qpid/sys/posix/Time.cpp index 0734abd1df..5e8f1aca0f 100644 --- a/cpp/src/qpid/sys/posix/Time.cpp +++ b/cpp/src/qpid/sys/posix/Time.cpp @@ -51,6 +51,8 @@ AbsTime AbsTime::now() { return time_now; } +AbsTime AbsTime::epoch() { return AbsTime(); } + Duration::Duration(const AbsTime& time0) : nanosecs(time0.timepoint) {} diff --git a/cpp/src/qpid/sys/windows/Time.cpp b/cpp/src/qpid/sys/windows/Time.cpp index 1d7b94e8d7..6b43347ef8 100644 --- a/cpp/src/qpid/sys/windows/Time.cpp +++ b/cpp/src/qpid/sys/windows/Time.cpp @@ -53,6 +53,10 @@ AbsTime AbsTime::now() { return time_now; } +AbsTime AbsTime::epoch() { + return AbsTime(boost::posix_time::from_time_t(0)); +} + Duration::Duration(const AbsTime& time0) : nanosecs(0) { time_period p(ptime(min_date_time), time0.timepoint); nanosecs = p.length().total_nanoseconds(); |