From 5366b629d3ebffca3b94304ecec9d536069d02c6 Mon Sep 17 00:00:00 2001 From: Roland Schwarz Date: Mon, 17 Jul 2006 10:17:12 +0000 Subject: [PATCH] Fallback to time if neither gettimeofday nor clock_gettime available. [SVN r34583] --- src/pthread/xtime.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pthread/xtime.cpp b/src/pthread/xtime.cpp index e6b6a700..b7492ed9 100644 --- a/src/pthread/xtime.cpp +++ b/src/pthread/xtime.cpp @@ -9,8 +9,11 @@ #include #include +// TODO: xtime possible should be replaced by boost date time #if defined(BOOST_HAS_GETTIMEOFDAY) # include +#elif ! defined (BOOST_HAS_CLOCK_GETTIME) +# include #endif namespace boost { @@ -32,7 +35,11 @@ int xtime_get(struct xtime* xtp, int clock_type) xtp->nsec = ts.tv_nsec; return clock_type; #else -# error "xtime_get implementation undefined" + time_t t; + time(&t); + xtp->sec = t; + xtp->nsec = 0; + return clock_type; #endif } return 0;