summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/value.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/value.cpp')
-rw-r--r--src/mongo/db/pipeline/value.cpp17
1 files changed, 1 insertions, 16 deletions
diff --git a/src/mongo/db/pipeline/value.cpp b/src/mongo/db/pipeline/value.cpp
index 9139f0cdbed..26f01e85d2e 100644
--- a/src/mongo/db/pipeline/value.cpp
+++ b/src/mongo/db/pipeline/value.cpp
@@ -426,22 +426,7 @@ namespace mongo {
}
time_t Value::coerceToTimeT() const {
- long long millis = coerceToDate();
- if (millis < 0) {
- // We want the division below to truncate toward -inf rather than 0
- // eg Dec 31, 1969 23:59:58.001 should be -2 seconds rather than -1
- // This is needed to get the correct values from coerceToTM
- if ( -1999 / 1000 != -2) { // this is implementation defined
- millis -= 1000-1;
- }
- }
- const long long seconds = millis / 1000;
-
- uassert(16421, "Can't handle date values outside of time_t range",
- seconds >= std::numeric_limits<time_t>::min() &&
- seconds <= std::numeric_limits<time_t>::max());
-
- return static_cast<time_t>(seconds);
+ return millisToTimeT(coerceToDate());
}
tm Value::coerceToTm() const {
// See implementation in Date_t.