From 49d626702cd5f20a4f96cc15f19fcf7098adcec8 Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 22 Sep 2017 00:23:02 +0200 Subject: [PATCH] Fix implicit sign conversion --- chrono/datetime.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chrono/datetime.cpp b/chrono/datetime.cpp index 7a713f3..dde1e01 100644 --- a/chrono/datetime.cpp +++ b/chrono/datetime.cpp @@ -314,14 +314,15 @@ uint64 DateTime::dateToTicks(int year, int month, int day) if (!inRangeInclMax(month, 1, 12)) { throw ConversionException("month is out of range"); } - const auto *daysToMonth = reinterpret_cast(isLeapYear(year) ? m_daysToMonth366 : m_daysToMonth365); + const auto *daysToMonth = reinterpret_cast(isLeapYear(year) ? m_daysToMonth366 : m_daysToMonth365); int passedMonth = month - 1; if (!inRangeInclMax(day, 1, daysToMonth[month] - daysToMonth[passedMonth])) { throw ConversionException("day is out of range"); } const auto passedYears = static_cast(year - 1); const auto passedDays = static_cast(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(daysToMonth[passedMonth]) + passedDays) * TimeSpan::m_ticksPerDay; }