diff options
author | Dan Pasette <dan@mongodb.com> | 2017-07-11 18:57:54 -0400 |
---|---|---|
committer | Dan Pasette <dan@mongodb.com> | 2017-07-11 18:57:54 -0400 |
commit | 99a0dfa12c700fe5ec4fd2170f17de37b24e9d55 (patch) | |
tree | 188f1111f05bf73f2248f4cfc6f7dc0c548a133c /src/mongo/db/query/datetime | |
parent | 0ebecb306cf68009f01ccde363debfff3b268a9a (diff) | |
download | mongo-99a0dfa12c700fe5ec4fd2170f17de37b24e9d55.tar.gz |
Revert "SERVER-29208 Add the $dateFromString aggregation operator"
This reverts commit b8de37d364fcde0ed2c93cdf8f5ed0001663e372.
Diffstat (limited to 'src/mongo/db/query/datetime')
-rw-r--r-- | src/mongo/db/query/datetime/date_time_support.cpp | 46 | ||||
-rw-r--r-- | src/mongo/db/query/datetime/date_time_support.h | 5 |
2 files changed, 0 insertions, 51 deletions
diff --git a/src/mongo/db/query/datetime/date_time_support.cpp b/src/mongo/db/query/datetime/date_time_support.cpp index 88ba04d5549..1356356665d 100644 --- a/src/mongo/db/query/datetime/date_time_support.cpp +++ b/src/mongo/db/query/datetime/date_time_support.cpp @@ -122,52 +122,6 @@ TimeZone TimeZoneDatabase::utcZone() { return TimeZone{nullptr}; } -extern "C" { -static timelib_tzinfo* timezonedatabase_gettzinfowrapper(char* tz_id, - const _timelib_tzdb* db, - int* error) { - uasserted( - 40544, - str::stream() - << "passing a time zone identifier as part of the string is not allowed, found: \"" - << tz_id - << "\""); - - return nullptr; -} - -} // extern "C" - -Date_t TimeZoneDatabase::fromString(StringData dateString) const { - std::unique_ptr<timelib_time, TimeZone::TimelibTimeDeleter> t( - timelib_strtotime(const_cast<char*>(dateString.toString().c_str()), - dateString.size(), - nullptr, - _timeZoneDatabase.get(), - timezonedatabase_gettzinfowrapper)); - - // If the time portion is fully missing, initialize to 0. This allows for the '%Y-%m-%d' format - // to be passed too, which is what the BI connector may request - if (t->h == TIMELIB_UNSET && t->i == TIMELIB_UNSET && t->s == TIMELIB_UNSET) { - t->h = t->i = t->s = t->f = 0; - } - - if (t->y == TIMELIB_UNSET || t->m == TIMELIB_UNSET || t->d == TIMELIB_UNSET || - t->h == TIMELIB_UNSET || t->i == TIMELIB_UNSET || t->s == TIMELIB_UNSET) { - uasserted(40545, - str::stream() - << "an incomplete date/time string has been found, with elements missing: \"" - << dateString - << "\""); - } - - timelib_update_ts(t.get(), nullptr); - timelib_unixtime2local(t.get(), t->sse); - - return Date_t::fromMillisSinceEpoch((static_cast<double>(t->sse) + static_cast<double>(t->f)) * - 1000); -} - TimeZone TimeZoneDatabase::getTimeZone(StringData timeZoneId) const { auto tz = _timeZones.find(timeZoneId); if (tz != _timeZones.end()) { diff --git a/src/mongo/db/query/datetime/date_time_support.h b/src/mongo/db/query/datetime/date_time_support.h index 0482cb70827..6f1e43aafad 100644 --- a/src/mongo/db/query/datetime/date_time_support.h +++ b/src/mongo/db/query/datetime/date_time_support.h @@ -303,11 +303,6 @@ public: std::unique_ptr<TimeZoneDatabase> timeZoneDatabase); /** - * Use the timezone database to create a Date_t from a string. - */ - Date_t fromString(StringData dateString) const; - - /** * Returns a TimeZone object representing the UTC time zone. */ static TimeZone utcZone(); |