summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2015-05-12 10:01:26 -0400
committerAndy Schwerin <schwerin@mongodb.com>2015-05-12 10:01:26 -0400
commit3681d3dbca85b25735fa0ec676828d1da191732d (patch)
tree5106b1e29186e92f31736278f79d39b4e1947b93 /src/mongo/db/pipeline
parent9aac625685811873ffbc2d3e8d09531eff1ce10e (diff)
downloadmongo-3681d3dbca85b25735fa0ec676828d1da191732d.tar.gz
Revert "SERVER-13874 Make mongo::Milliseconds et al. aliases for equivalent stdx::chrono types."
This reverts commit 9aac625685811873ffbc2d3e8d09531eff1ce10e. Committed in error.
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r--src/mongo/db/pipeline/expression.cpp4
-rw-r--r--src/mongo/db/pipeline/value.cpp7
-rw-r--r--src/mongo/db/pipeline/value.h6
3 files changed, 10 insertions, 7 deletions
diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression.cpp
index e8c121c2b04..defc38d8c12 100644
--- a/src/mongo/db/pipeline/expression.cpp
+++ b/src/mongo/db/pipeline/expression.cpp
@@ -422,7 +422,7 @@ namespace {
if (haveDate) {
if (totalType == NumberDouble)
longTotal = static_cast<long long>(doubleTotal);
- return Value(Date_t::fromMillisSinceEpoch(longTotal));
+ return Value(Date_t(longTotal));
}
else if (totalType == NumberLong) {
return Value(longTotal);
@@ -2548,7 +2548,7 @@ namespace {
}
else if (rhs.numeric()) {
long long millisSinceEpoch = lhs.getDate() - rhs.coerceToLong();
- return Value(Date_t::fromMillisSinceEpoch(millisSinceEpoch));
+ return Value(Date_t(millisSinceEpoch));
}
else {
uasserted(16613, str::stream() << "cant $subtract a "
diff --git a/src/mongo/db/pipeline/value.cpp b/src/mongo/db/pipeline/value.cpp
index c949601ac4d..b156d290613 100644
--- a/src/mongo/db/pipeline/value.cpp
+++ b/src/mongo/db/pipeline/value.cpp
@@ -186,7 +186,8 @@ namespace mongo {
break;
case Date:
- _storage.dateValue = elem.date().toMillisSinceEpoch();
+ // this is really signed but typed as unsigned for historical reasons
+ _storage.dateValue = static_cast<long long>(elem.date().millis);
break;
case RegEx: {
@@ -287,7 +288,7 @@ namespace mongo {
case NumberDouble: return builder << val.getDouble();
case String: return builder << val.getStringData();
case Bool: return builder << val.getBool();
- case Date: return builder << Date_t::fromMillisSinceEpoch(val.getDate());
+ case Date: return builder << Date_t(val.getDate());
case bsonTimestamp: return builder << val.getTimestamp();
case Object: return builder << val.getDocument();
case Symbol: return builder << BSONSymbol(val.getStringData());
@@ -1017,7 +1018,7 @@ namespace mongo {
case NumberLong: return Value(buf.read<long long>());
case NumberDouble: return Value(buf.read<double>());
case Bool: return Value(bool(buf.read<char>()));
- case Date: return Value(Date_t::fromMillisSinceEpoch(buf.read<long long>()));
+ case Date: return Value(Date_t(buf.read<long long>()));
case bsonTimestamp: return Value(buf.read<Timestamp>());
// types that are like strings
diff --git a/src/mongo/db/pipeline/value.h b/src/mongo/db/pipeline/value.h
index ecc66719d11..5324cc1b432 100644
--- a/src/mongo/db/pipeline/value.h
+++ b/src/mongo/db/pipeline/value.h
@@ -91,7 +91,9 @@ namespace mongo {
explicit Value(const UndefinedLabeler&) : _storage(Undefined) {} // BSONUndefined
explicit Value(const MinKeyLabeler&) : _storage(MinKey) {} // MINKEY
explicit Value(const MaxKeyLabeler&) : _storage(MaxKey) {} // MAXKEY
- explicit Value(const Date_t& date) : _storage(Date, date.toMillisSinceEpoch()) {}
+ explicit Value(const Date_t& date)
+ : _storage(Date, static_cast<long long>(date.millis)) // millis really signed
+ {}
// TODO: add an unsafe version that can share storage with the BSONElement
/// Deep-convert from BSONElement to Value
@@ -315,7 +317,7 @@ namespace mongo {
inline Timestamp Value::getTimestamp() const {
verify(getType() == bsonTimestamp);
- return Timestamp(_storage.timestampValue);
+ return Date_t(_storage.timestampValue);
}
inline const char* Value::getRegex() const {