From 966cef19aa3faaf74c8b9cad3386c2e9314d6800 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 8 Dec 2023 13:45:04 -0800 Subject: [PATCH] Bug 799156 - normalize_struct_tm() does not normalize seconds,... minutes, and hours correctly. Fix proposed by Sherlock. --- libgnucash/engine/gnc-date.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgnucash/engine/gnc-date.cpp b/libgnucash/engine/gnc-date.cpp index b5f2acb948..f8c45fa689 100644 --- a/libgnucash/engine/gnc-date.cpp +++ b/libgnucash/engine/gnc-date.cpp @@ -126,7 +126,7 @@ gnc_localtime_r (const time64 *secs, struct tm* time) } static void -normalize_time_component (int *inner, int *outer, unsigned int divisor, +normalize_time_component (int *inner, int *outer, int divisor, int base) { while (*inner < base) @@ -134,7 +134,7 @@ normalize_time_component (int *inner, int *outer, unsigned int divisor, --(*outer); *inner += divisor; } - while (*inner > static_cast(divisor)) + while (*inner >= divisor + base) { ++(*outer); *inner -= divisor;