Fix implicit sign conversion
This commit is contained in:
parent
72806d69fd
commit
49d626702c
|
@ -314,14 +314,15 @@ uint64 DateTime::dateToTicks(int year, int month, int day)
|
||||||
if (!inRangeInclMax(month, 1, 12)) {
|
if (!inRangeInclMax(month, 1, 12)) {
|
||||||
throw ConversionException("month is out of range");
|
throw ConversionException("month is out of range");
|
||||||
}
|
}
|
||||||
const auto *daysToMonth = reinterpret_cast<const unsigned int *>(isLeapYear(year) ? m_daysToMonth366 : m_daysToMonth365);
|
const auto *daysToMonth = reinterpret_cast<const int *>(isLeapYear(year) ? m_daysToMonth366 : m_daysToMonth365);
|
||||||
int passedMonth = month - 1;
|
int passedMonth = month - 1;
|
||||||
if (!inRangeInclMax(day, 1, daysToMonth[month] - daysToMonth[passedMonth])) {
|
if (!inRangeInclMax(day, 1, daysToMonth[month] - daysToMonth[passedMonth])) {
|
||||||
throw ConversionException("day is out of range");
|
throw ConversionException("day is out of range");
|
||||||
}
|
}
|
||||||
const auto passedYears = static_cast<unsigned int>(year - 1);
|
const auto passedYears = static_cast<unsigned int>(year - 1);
|
||||||
const auto passedDays = static_cast<unsigned int>(day - 1);
|
const auto passedDays = static_cast<unsigned int>(day - 1);
|
||||||
return (passedYears * m_daysPerYear + passedYears / 4 - passedYears / 100 + passedYears / 400 + daysToMonth[passedMonth] + passedDays)
|
return (passedYears * m_daysPerYear + passedYears / 4 - passedYears / 100 + passedYears / 400
|
||||||
|
+ static_cast<unsigned int>(daysToMonth[passedMonth]) + passedDays)
|
||||||
* TimeSpan::m_ticksPerDay;
|
* TimeSpan::m_ticksPerDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue