Skip to content

Commit c0a6852

Browse files
committed
OpTime needs to handle clock skew SERVER-703
1 parent cc206ec commit c0a6852

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

util/optime.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ namespace mongo {
4646
static OpTime now() {
4747
unsigned t = (unsigned) time(0);
4848
// DEV assertInWriteLock();
49+
if ( t < last.secs ){
50+
log() << "clock skew detected prev: " << last.secs << " now: " << t << " trying to handle..." << endl;
51+
t = last.secs;
52+
}
4953
if ( last.secs == t ) {
5054
last.i++;
5155
return last;

0 commit comments

Comments
 (0)