0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

fix sleepmillis

This commit is contained in:
Aaron 2009-04-03 15:34:44 -04:00
parent ebaf4292d6
commit 80c3078d1a

View File

@ -176,11 +176,12 @@ namespace mongo {
inline void sleepmillis(int s) {
boost::xtime xt;
boost::xtime_get(&xt, boost::TIME_UTC);
if( s >= 1000 ) {
xt.sec += s/1000;
s-=1000;
}
xt.nsec += s * 1000000;
xt.sec += ( s / 1000 );
xt.nsec += ( s % 1000 ) * 1000000;
if ( xt.nsec >= 1000000000 ) {
xt.nsec -= 1000000000;
xt.sec++;
}
boost::thread::sleep(xt);
}
// note this wraps