summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-03-04 23:14:03 -0500
committerEliot Horowitz <eliot@10gen.com>2010-03-06 22:21:34 -0500
commitc0a685292abfe4fc9532941ac1f325e4bf233449 (patch)
treed0d9b70b0584e350c09fd95b7c5c2d090cc1bf7f
parentcc206ecdf653b074d0e3ad1b639e1ce782888219 (diff)
downloadmongo-c0a685292abfe4fc9532941ac1f325e4bf233449.tar.gz
OpTime needs to handle clock skew SERVER-703
-rw-r--r--util/optime.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/optime.h b/util/optime.h
index cfff86b1c78..4e523a6409c 100644
--- a/util/optime.h
+++ b/util/optime.h
@@ -46,6 +46,10 @@ namespace mongo {
static OpTime now() {
unsigned t = (unsigned) time(0);
// DEV assertInWriteLock();
+ if ( t < last.secs ){
+ log() << "clock skew detected prev: " << last.secs << " now: " << t << " trying to handle..." << endl;
+ t = last.secs;
+ }
if ( last.secs == t ) {
last.i++;
return last;