From b2aed733978d527b46662c5c137869ac288f1563 Mon Sep 17 00:00:00 2001 From: Patrick Wassmer Date: Thu, 7 Mar 2019 21:13:34 +0100 Subject: [PATCH] Fix #178 --- src/CalcViewModel/Common/DateCalculator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CalcViewModel/Common/DateCalculator.cpp b/src/CalcViewModel/Common/DateCalculator.cpp index 79092216..597cd1f9 100644 --- a/src/CalcViewModel/Common/DateCalculator.cpp +++ b/src/CalcViewModel/Common/DateCalculator.cpp @@ -206,7 +206,8 @@ void DateCalculationEngine::GetDateDifference(_In_ DateTime date1, _In_ DateTime int DateCalculationEngine::GetDifferenceInDays(DateTime date1, DateTime date2) { // A tick is defined as the number of 100 nanoseconds - long long ticksDifference = date2.UniversalTime - date1.UniversalTime; + // Add one hour to the difference to have correct number of days when change of daylight time (winter to summer) happens between date1 and date2 + long long ticksDifference = date2.UniversalTime - date1.UniversalTime + c_hour; return static_cast(ticksDifference / static_cast(c_day)); }