summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/SConscript1
-rw-r--r--src/mongo/db/global_timestamp.cpp6
-rw-r--r--src/mongo/db/ops/SConscript2
3 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index a4ef79cb40e..44acf010272 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -225,6 +225,7 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/db/service_context'
]
)
diff --git a/src/mongo/db/global_timestamp.cpp b/src/mongo/db/global_timestamp.cpp
index b096feda9cc..d380e2a4f05 100644
--- a/src/mongo/db/global_timestamp.cpp
+++ b/src/mongo/db/global_timestamp.cpp
@@ -29,8 +29,11 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
#include "mongo/db/global_timestamp.h"
+#include "mongo/db/service_context.h"
#include "mongo/platform/atomic_word.h"
+#include "mongo/util/clock_source.h"
#include "mongo/util/log.h"
+#include "mongo/util/time_support.h"
namespace mongo {
namespace {
@@ -46,7 +49,8 @@ Timestamp getLastSetTimestamp() {
}
Timestamp getNextGlobalTimestamp() {
- const unsigned now = Date_t::now().toMillisSinceEpoch() / 1000;
+ const unsigned now = durationCount<Seconds>(
+ getGlobalServiceContext()->getFastClockSource()->now().toDurationSinceEpoch());
// Optimistic approach: just increment the timestamp, assuming the seconds still match.
auto next = globalTimestamp.addAndFetch(1);
diff --git a/src/mongo/db/ops/SConscript b/src/mongo/db/ops/SConscript
index e91110656a4..ab345cb238c 100644
--- a/src/mongo/db/ops/SConscript
+++ b/src/mongo/db/ops/SConscript
@@ -108,6 +108,7 @@ env.CppUnitTest(
source='modifier_current_date_test.cpp',
LIBDEPS=[
'$BUILD_DIR/mongo/bson/mutable/mutable_bson_test_utils',
+ '$BUILD_DIR/mongo/db/service_context_noop_init',
'update',
],
)
@@ -126,6 +127,7 @@ env.CppUnitTest(
source='modifier_object_replace_test.cpp',
LIBDEPS=[
'$BUILD_DIR/mongo/bson/mutable/mutable_bson_test_utils',
+ '$BUILD_DIR/mongo/db/service_context_noop_init',
'update',
],
)