Skip to content

Commit

Permalink
fix sleepmillis
Browse files Browse the repository at this point in the history
  • Loading branch information
astaple committed Apr 3, 2009
1 parent ebaf429 commit 80c3078
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions util/goodies.h
Expand Up @@ -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
Expand Down

0 comments on commit 80c3078

Please sign in to comment.