summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bsonelement.h
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2015-04-07 16:42:23 -0400
committerEric Milkie <milkie@10gen.com>2015-04-08 16:27:14 -0400
commite87716a9286b6aa6f63a513012e55f6e42f634a2 (patch)
tree06e906a531f9699bc6e5bee143339eee4bf8841a /src/mongo/bson/bsonelement.h
parent655f6f61888035798519a5866dec9f9d76f7c224 (diff)
downloadmongo-e87716a9286b6aa6f63a513012e55f6e42f634a2.tar.gz
SERVER-15047 Remove undefined behavior from Timestamp
Diffstat (limited to 'src/mongo/bson/bsonelement.h')
-rw-r--r--src/mongo/bson/bsonelement.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h
index cc5c687f8d7..a5919d7f6d7 100644
--- a/src/mongo/bson/bsonelement.h
+++ b/src/mongo/bson/bsonelement.h
@@ -454,9 +454,10 @@ namespace mongo {
}
Timestamp timestamp() const {
+ Timestamp result;
if( type() == mongo::Date || type() == bsonTimestamp )
- return Timestamp(ConstDataView(value()).readLE<unsigned long long>());
- return Timestamp();
+ result.readFrom(value());
+ return result;
}
Date_t timestampTime() const {