2
0
mirror of https://github.com/boostorg/thread.git synced 2026-02-14 01:02:14 +00:00

Fallback to time if neither gettimeofday nor clock_gettime available.

[SVN r34583]
This commit is contained in:
Roland Schwarz
2006-07-17 10:17:12 +00:00
parent 01b2d5c088
commit 5366b629d3

View File

@@ -9,8 +9,11 @@
#include <boost/thread/pthread/config.hpp>
#include <boost/thread/pthread/xtime.hpp>
// TODO: xtime possible should be replaced by boost date time
#if defined(BOOST_HAS_GETTIMEOFDAY)
# include <sys/time.h>
#elif ! defined (BOOST_HAS_CLOCK_GETTIME)
# include <time.h>
#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;