diff options
author | Fred Hornsey <hornseyf@objectcomputing.com> | 2019-10-23 18:05:56 -0500 |
---|---|---|
committer | Fred Hornsey <hornseyf@objectcomputing.com> | 2019-10-23 18:17:13 -0500 |
commit | 85f3741cc5fa939162ae6445d67290b986ba76d9 (patch) | |
tree | c4bc350fb5564a5963a958049041ed134ae5343a /ACE/ace/Monotonic_Time_Policy.inl | |
parent | 57c52c1183d8d5e11e725fc9886263dfca11f22c (diff) | |
download | ATCD-85f3741cc5fa939162ae6445d67290b986ba76d9.tar.gz |
Expose Monotonic Time Support in Macros
Expose support `ACE_Monotonic_Time_Policy` using
`ACE_HAS_MONOTONIC_TIME_POLICY` and support for monotonic conditions
using `ACE_HAS_MONOTONIC_CONDITIONS`.
Also refactored macros to try to simplify them while retaining
compatibility.
Diffstat (limited to 'ACE/ace/Monotonic_Time_Policy.inl')
-rw-r--r-- | ACE/ace/Monotonic_Time_Policy.inl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ACE/ace/Monotonic_Time_Policy.inl b/ACE/ace/Monotonic_Time_Policy.inl index bef06a049da..8afd51ebcab 100644 --- a/ACE/ace/Monotonic_Time_Policy.inl +++ b/ACE/ace/Monotonic_Time_Policy.inl @@ -7,16 +7,20 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Time_Value_T<ACE_Monotonic_Time_Policy> ACE_Monotonic_Time_Policy::operator()() const { -# if defined (ACE_WIN32) +#if defined (ACE_HAS_MONOTONIC_TIME_POLICY) +# if defined (ACE_WIN32) return ACE_Time_Value_T<ACE_Monotonic_Time_Policy> (ACE_High_Res_Timer::gettimeofday_hr ()); -#elif (defined (_POSIX_MONOTONIC_CLOCK) && !defined (ACE_LACKS_MONOTONIC_TIME)) || defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC) +# elif defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC) struct timespec ts; if (ACE_OS::clock_gettime (CLOCK_MONOTONIC, &ts) == 0) return ACE_Time_Value_T<ACE_Monotonic_Time_Policy>(ts); else return ACE_Time_Value_T<ACE_Monotonic_Time_Policy> (ACE_Time_Value::zero); -#else +# else +# error "ACE_HAS_MONOTONIC_TIME_POLICY is defined, no implementation is valid" +# endif /* ACE_WIN32 */ +#else /* !ACE_HAS_MONOTONIC_TIME_POLICY */ return ACE_Time_Value_T<ACE_Monotonic_Time_Policy> (ACE_Time_Value::zero); #endif } |