chrono.cpp: suppress clock_gettime()
This commit is contained in:
@@ -116,10 +116,16 @@ steady_clock::now()
|
|||||||
steady_clock::time_point
|
steady_clock::time_point
|
||||||
steady_clock::now()
|
steady_clock::now()
|
||||||
{
|
{
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
timeval tv;
|
||||||
|
gettimeofday(&tv, 0);
|
||||||
|
return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
|
||||||
|
#else
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
|
if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
|
||||||
__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
|
__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
|
||||||
return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
|
return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user