aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2009-12-21 17:03:33 +0100
committerTobias Brunner <tobias@strongswan.org>2009-12-23 17:03:41 +0100
commitb2944d71ca15b796c021a6cf89a8c67e46e2444a (patch)
tree27cd90bcce02f88c3087805c9b5a959be2378db8 /src/libstrongswan/utils.c
parent01e606546ca647989cbc781412036e6ade32cb6f (diff)
downloadstrongswan-b2944d71ca15b796c021a6cf89a8c67e46e2444a.tar.bz2
strongswan-b2944d71ca15b796c021a6cf89a8c67e46e2444a.tar.xz
Use pthread_cond_timedwait_monotonic on Android.
Diffstat (limited to 'src/libstrongswan/utils.c')
-rw-r--r--src/libstrongswan/utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstrongswan/utils.c b/src/libstrongswan/utils.c
index a3cb87056..e331ac0d0 100644
--- a/src/libstrongswan/utils.c
+++ b/src/libstrongswan/utils.c
@@ -167,7 +167,9 @@ bool mkdir_p(const char *path, mode_t mode)
*/
time_t time_monotonic(timeval_t *tv)
{
-#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_CONDATTR_CLOCK_MONOTONIC)
+#if defined(HAVE_CLOCK_GETTIME) && \
+ (defined(HAVE_CONDATTR_CLOCK_MONOTONIC) || \
+ defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC))
/* as we use time_monotonic() for condvar operations, we use the
* monotonic time source only if it is also supported by pthread. */
timespec_t ts;
@@ -181,7 +183,7 @@ time_t time_monotonic(timeval_t *tv)
}
return ts.tv_sec;
}
-#endif /* HAVE_CLOCK_MONOTONIC && HAVE_CONDATTR_CLOCK_MONOTONIC */
+#endif /* HAVE_CLOCK_GETTIME && (...) */
/* Fallback to non-monotonic timestamps:
* On MAC OS X, creating monotonic timestamps is rather difficult. We
* could use mach_absolute_time() and catch sleep/wakeup notifications.