diff options
author | Alberto Massari <alberto.massari@mongodb.com> | 2022-09-29 10:55:09 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-29 11:41:07 +0000 |
commit | 610dbc3b0bea69b9622429e4d5e550b95d2f8ffe (patch) | |
tree | 93dca70ca18fbfc03212bef439e0844a0c5d9651 | |
parent | 4c1a21e6aa479d186d0550cb101906a8ffe4d2e8 (diff) | |
download | mongo-610dbc3b0bea69b9622429e4d5e550b95d2f8ffe.tar.gz |
SERVER-68289 Use new, faster, API from timelib
-rw-r--r-- | src/mongo/db/query/datetime/date_time_support.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mongo/db/query/datetime/date_time_support.cpp b/src/mongo/db/query/datetime/date_time_support.cpp index c17d44dcf1f..d11bd53f325 100644 --- a/src/mongo/db/query/datetime/date_time_support.cpp +++ b/src/mongo/db/query/datetime/date_time_support.cpp @@ -577,11 +577,15 @@ long long TimeZone::isoYear(Date_t date) const { Seconds TimeZone::utcOffset(Date_t date) const { if (isTimeZoneIDZone()) { - auto* offset = timelib_get_time_zone_info( - durationCount<Seconds>(date.toDurationSinceEpoch()), _tzInfo.get()); - auto timezoneOffsetFromUTC = Seconds(offset->offset); - timelib_time_offset_dtor(offset); - return timezoneOffsetFromUTC; + int32_t timezoneOffsetFromUTC = 0; + int result = + timelib_get_time_zone_offset_info(durationCount<Seconds>(date.toDurationSinceEpoch()), + _tzInfo.get(), + &timezoneOffsetFromUTC, + nullptr, + nullptr); + uassert(6828900, "Failed to obtain timezone offset", result); + return Seconds(timezoneOffsetFromUTC); } else { return _utcOffset; } |