summaryrefslogtreecommitdiff
path: root/src/mongo/db/logical_time.cpp
diff options
context:
space:
mode:
authorMisha Tyulenev <misha@mongodb.com>2017-09-27 23:23:24 -0400
committerMisha Tyulenev <misha@mongodb.com>2017-09-27 23:23:46 -0400
commiteeee1e2b64f70e8487f017ba579f3ca861c81e4f (patch)
treee1452828e142748f1f03be61a00c32dbb3ed6bc1 /src/mongo/db/logical_time.cpp
parent55637833c707998f685f997d43624c52cde99b45 (diff)
downloadmongo-eeee1e2b64f70e8487f017ba579f3ca861c81e4f.tar.gz
SERVER-30977 add clusterTime to standalone replica set
Diffstat (limited to 'src/mongo/db/logical_time.cpp')
-rw-r--r--src/mongo/db/logical_time.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/db/logical_time.cpp b/src/mongo/db/logical_time.cpp
index 1bb5ce5b62f..709c43db2f6 100644
--- a/src/mongo/db/logical_time.cpp
+++ b/src/mongo/db/logical_time.cpp
@@ -68,9 +68,7 @@ LogicalTime LogicalTime::addTicks(uint64_t ticks) const {
}
std::string LogicalTime::toString() const {
- StringBuilder buf;
- buf << asTimestamp().toString();
- return buf.str();
+ return toBSON().toString();
}
std::array<unsigned char, sizeof(uint64_t)> LogicalTime::toUnsignedArray() const {
@@ -79,4 +77,10 @@ std::array<unsigned char, sizeof(uint64_t)> LogicalTime::toUnsignedArray() const
return output;
}
+BSONObj LogicalTime::toBSON() const {
+ BSONObjBuilder bldr;
+ bldr.append("ts", asTimestamp());
+ return bldr.obj();
+}
+
} // namespace mongo