Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12727: Using sleep_for with nanoseconds on a boost::thread does not always use the correct clock
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-02-18 09:15:09
#12727: Using sleep_for with nanoseconds on a boost::thread does not always use the
correct clock
-------------------------------+----------------------
Reporter: rkaris@⦠| Owner: viboes
Type: Bugs | Status: assigned
Milestone: To Be Determined | Component: thread
Version: Boost 1.63.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+----------------------
Comment (by viboes):
Wondering if you are referring to
{{{
inline timespec timespec_now()
{
timespec ts;
#ifdef CLOCK_MONOTONIC
if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
{
BOOST_ASSERT(0 && "Boost::Thread - Internal Error");
}
#elif defined(BOOST_THREAD_TIMESPEC_MAC_API)
timeval tv;
::gettimeofday(&tv, 0);
ts.tv_sec = tv.tv_sec;
ts.tv_nsec = tv.tv_usec * 1000;
#else
if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
{
BOOST_ASSERT(0 && "Boost::Thread - Internal Error");
}
#endif
return ts;
}
}}}
Please let me know if adding the following solves the issue
{{{
#ifdef CLOCK_MONOTONIC
if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
{
BOOST_ASSERT(0 && "Boost::Thread - Internal Error");
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12727#comment:3> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-18 09:19:08 UTC