summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2016-06-17 20:00:14 -0400
committerAndy Schwerin <schwerin@mongodb.com>2016-06-20 10:26:23 -0400
commit1b34b0449974e123bd85d140566b577b4e326fbd (patch)
treefffa99e2ff23a349e3d0b94a159e35834f8e02ae /src/mongo
parent244070f7360ef62c263e20a958d54ae2c9a37cf5 (diff)
downloadmongo-1b34b0449974e123bd85d140566b577b4e326fbd.tar.gz
SERVER-18580 Make OIDTests::FromDate deterministic.
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/dbtests/jsobjtests.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp
index b9bc00cde19..b02bd9804e4 100644
--- a/src/mongo/dbtests/jsobjtests.cpp
+++ b/src/mongo/dbtests/jsobjtests.cpp
@@ -1398,14 +1398,14 @@ class FromDate {
public:
void run() {
OID min, oid, max;
- Date_t now = jsTime();
- oid.init(); // slight chance this has different time. If its a problem, can change.
- min.init(now);
+ oid.init();
+ const Date_t now = oid.asDateT();
+ min.init(now, false);
max.init(now, true);
- ASSERT_EQUALS((unsigned)oid.asTimeT(), now / 1000);
- ASSERT_EQUALS((unsigned)min.asTimeT(), now / 1000);
- ASSERT_EQUALS((unsigned)max.asTimeT(), now / 1000);
+ ASSERT_EQUALS(oid.asDateT(), now);
+ ASSERT_EQUALS(min.asDateT(), now);
+ ASSERT_EQUALS(max.asDateT(), now);
ASSERT(BSON("" << min).woCompare(BSON("" << oid)) < 0);
ASSERT(BSON("" << max).woCompare(BSON("" << oid)) > 0);
}