diff options
author | Misha Tyulenev <misha@mongodb.com> | 2017-09-27 23:23:24 -0400 |
---|---|---|
committer | Misha Tyulenev <misha@mongodb.com> | 2017-09-27 23:23:46 -0400 |
commit | eeee1e2b64f70e8487f017ba579f3ca861c81e4f (patch) | |
tree | e1452828e142748f1f03be61a00c32dbb3ed6bc1 /src/mongo/db/logical_time.cpp | |
parent | 55637833c707998f685f997d43624c52cde99b45 (diff) | |
download | mongo-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.cpp | 10 |
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 |