Boost timed_wait leap seconds problem
Posted
by Isac
on Stack Overflow
See other posts from Stack Overflow
or by Isac
Published on 2010-05-06T21:26:23Z
Indexed on
2010/05/06
21:28 UTC
Read the original article
Hit count: 803
Hi, I am using the timed_wait from boost C++ library and I am getting a problem with leap seconds.
Here is a quick example from boosts documentation:
boost::system_time const timeout=boost::get_system_time() + boost::posix_time::milliseconds(500);
extern bool done;
extern boost::mutex m;
extern boost::condition_variable cond;
boost::unique_lock<boost::mutex> lk(m);
while(!done)
{
if(!cond.timed_wait(lk,timeout))
{
throw "timed out";
}
}
The timed_wait function is returning 24 seconds earlier than it should. 24 seconds is the current amount of leap seconds in UTC.
So, boost is widely used but I could not find any info about this particular problem. Has anyone else experienced this problem? What are the possible causes and solutions?
Notes: I am using boost 1.38 on a linux system. I've heard that this problem doesn't happen on MacOS.
© Stack Overflow or respective owner