Adjustments

This commit is contained in:
Alexey Milovidov 2021-03-04 05:18:17 +03:00
parent 6dc21cd098
commit b9a8509f79
2 changed files with 3 additions and 12 deletions

View File

@ -402,7 +402,6 @@ public:
time_t time = t - lut[index].date;
/// Data is cleaned to avoid possibility of underflow.
if (time >= lut[index].time_at_offset_change())
time += lut[index].amount_of_offset_change();
@ -454,8 +453,8 @@ public:
inline unsigned toMinute(time_t t) const
{
if (offset_is_whole_number_of_hours_everytime)
return mod((t / 60), 60);
if (offset_is_whole_number_of_hours_everytime && t >= 0)
return (t / 60) % 60;
/// To consider the DST changing situation within this day.
/// also make the special timezones with no whole hour offset such as 'Australia/Lord_Howe' been taken into account

View File

@ -267,7 +267,7 @@ TEST(DateLUTTest, TimeValuesAtRightBoderOfRangeOfOldLUT)
class DateLUTWithTimeZone : public ::testing::TestWithParam<const char * /* timezone name */>
{};
TEST_P(DateLUTWithTimeZone, DISABLED_LoadLUT)
TEST_P(DateLUTWithTimeZone, LoadLUT)
{
// There are some assumptions and assertions about TZ data made in DateLUTImpl which are verified upon loading,
// to make sure that those assertions are true for all timezones we are going to load all of them one by one.
@ -317,14 +317,6 @@ TEST_P(DateLUTWithTimeZone, getTimeZone)
EXPECT_EQ(GetParam(), lut.getTimeZone());
}
TEST_P(DateLUTWithTimeZone, ZeroTime)
{
const auto & lut = DateLUT::instance(GetParam());
EXPECT_EQ(0, lut.toDayNum(time_t{0}));
EXPECT_EQ(0, lut.toDayNum(DayNum{0}));
EXPECT_EQ(0, lut.toDayNum(ExtendedDayNum{0}));
}
// Group of tests for timezones that have or had some time ago an offset which is not multiple of 15 minutes.
INSTANTIATE_TEST_SUITE_P(ExoticTimezones,