Boost logo

Boost :

From: Daggumati, Rajesh (rajesh.daggumati_at_[hidden])
Date: 2022-06-20 07:10:06


Hi Team,
When I use boost sleep function, I am getting delayed response.
How to overcome this issue.
Is there any alternative for this?

boost::posix_time::ptime t1 = boost::posix_time::microsec_clock::local_time();
boost::this_thread::sleep(boost::posix_time::millisec(10000));
boost::posix_time::ptime t2 = boost::posix_time::microsec_clock::local_time();
boost::this_thread::sleep(boost::posix_time::millisec(10000));
boost::posix_time::ptime t3 = boost::posix_time::microsec_clock::local_time();
boost::posix_time::time_duration diff = t2 - t1;
std::cout << diff.total_milliseconds() << std::endl;
boost::posix_time::time_duration diff1 = t3 - t2;
std::cout << diff1.total_milliseconds() << std::endl;

output is :
  10005
  10006

Expected ouput should be 10000 and 10000

Regards,
Rajesh D
Please be advised that this email may contain confidential information. If you are not the intended recipient, please notify us by email by replying to the sender and delete this message. The sender disclaims that the content of this email constitutes an offer to enter into, or the acceptance of, any agreement; provided that the foregoing does not invalidate the binding effect of any digital or other electronic reproduction of a manual signature that is included in any attachment.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk