summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/datetime
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/query/datetime
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/db/query/datetime')
-rw-r--r--src/mongo/db/query/datetime/date_time_support.cpp2
-rw-r--r--src/mongo/db/query/datetime/date_time_support_test.cpp25
2 files changed, 8 insertions, 19 deletions
diff --git a/src/mongo/db/query/datetime/date_time_support.cpp b/src/mongo/db/query/datetime/date_time_support.cpp
index 93859935c98..1fe0ecd81d0 100644
--- a/src/mongo/db/query/datetime/date_time_support.cpp
+++ b/src/mongo/db/query/datetime/date_time_support.cpp
@@ -842,7 +842,7 @@ StringData serializeTimeUnit(TimeUnit unit) {
case TimeUnit::millisecond:
return "millisecond"_sd;
}
- MONGO_UNREACHABLE_TASSERT(5339903);
+ MONGO_UNREACHABLE_TASSERT(5339900);
}
DayOfWeek parseDayOfWeek(StringData dayOfWeek) {
diff --git a/src/mongo/db/query/datetime/date_time_support_test.cpp b/src/mongo/db/query/datetime/date_time_support_test.cpp
index df6e97c979a..d2b2e3b2d44 100644
--- a/src/mongo/db/query/datetime/date_time_support_test.cpp
+++ b/src/mongo/db/query/datetime/date_time_support_test.cpp
@@ -2629,10 +2629,7 @@ TEST(DateAdd, DateAddWithTimezoneDST) {
{europeAmsterdamZone.createFromDateParts(2020, 10, 24, 2, 0, 1, 0),
TimeUnit::day,
1,
- europeAmsterdamZone.createFromDateParts(2020, 10, 25, 1, 59, 59, 0) +
- Milliseconds{2000}}, // as this date is ambiguous (it could in both timezones, with or
- // without DST) and the computation is expected to return the
- // "with DST" one, obtain it via a computation
+ europeAmsterdamZone.createFromDateParts(2020, 10, 25, 2, 0, 1, 0)},
{europeAmsterdamZone.createFromDateParts(2020, 10, 24, 3, 0, 1, 0),
TimeUnit::day,
1,
@@ -2724,13 +2721,10 @@ TEST(DateAdd, DateAddWithTimezoneDST) {
TimeUnit::day,
1,
newYorkZone.createFromDateParts(2020, 11, 2, 1, 30, 0, 0)},
- {newYorkZone.createFromDateParts(2020, 10, 31, 1, 0, 1, 0),
+ {newYorkZone.createFromDateParts(2020, 10, 31, 1, 30, 0, 0),
TimeUnit::day,
1,
- newYorkZone.createFromDateParts(2020, 11, 1, 0, 59, 59, 0) +
- Milliseconds{2000}}, // as this date is ambiguous (it could in both timezones, with or
- // without DST) and the computation is expected to return the
- // "with DST" one, obtain it via a computation
+ newYorkZone.createFromDateParts(2020, 11, 1, 1, 30, 0, 0)},
{newYorkZone.createFromDateParts(2020, 11, 1, 3, 0, 0, 0),
TimeUnit::day,
-1,
@@ -2791,20 +2785,15 @@ TEST(DateAdd, DateAdd_LordHoweTimezoneDST) {
auto australiaLordHoweZone = kDefaultTimeZoneDatabase.getTimeZone("Australia/Lord_Howe");
std::vector<TestCase> tests{
// DST to Standard change: 2021-04-04T02:00:00 -> 2021-04-04T01:30:00 Lord Howe timezone.
- {australiaLordHoweZone.createFromDateParts(2021, 4, 4, 1, 29, 59, 0) +
- Milliseconds{1000}, // as this date is ambiguous (it could in both timezones, with or
- // without DST) and the computation is expected to start from the
- // "with DST" one, obtain it via a computation
+ {australiaLordHoweZone.createFromDateParts(2021, 4, 4, 1, 30, 0, 0),
TimeUnit::day,
1,
australiaLordHoweZone.createFromDateParts(2021, 4, 5, 1, 30, 0, 0)},
- {australiaLordHoweZone.createFromDateParts(2021, 4, 3, 1, 30, 1, 0),
+ {australiaLordHoweZone.createFromDateParts(2021, 4, 3, 1, 45, 0, 0),
TimeUnit::day,
1,
- australiaLordHoweZone.createFromDateParts(2021, 4, 4, 1, 29, 59, 0) +
- Milliseconds{2000}}, // as this date is ambiguous (it could in both timezones, with or
- // without DST) and the computation is expected to return the
- // "with DST" one, obtain it via a computation
+ // Computed time falls into the repeated 1/2 hour.
+ australiaLordHoweZone.createFromDateParts(2021, 4, 4, 1, 45, 0, 0)},
{australiaLordHoweZone.createFromDateParts(2021, 4, 5, 1, 0, 0, 0),
TimeUnit::day,
-1,