From 1e289cb2b812413ea706fdc7dba9a259da70e3a7 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 8 Dec 2023 13:47:24 -0800 Subject: [PATCH] GncDate: Remove pointless normalize_month function. Suggested by Sherlock. --- libgnucash/engine/gnc-date.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libgnucash/engine/gnc-date.cpp b/libgnucash/engine/gnc-date.cpp index f8c45fa689..4d5e651744 100644 --- a/libgnucash/engine/gnc-date.cpp +++ b/libgnucash/engine/gnc-date.cpp @@ -141,14 +141,6 @@ normalize_time_component (int *inner, int *outer, int divisor, } } -static void -normalize_month(int *month, int *year) -{ - ++(*month); - normalize_time_component(month, year, 12, 1); - --(*month); -} - static void normalize_struct_tm (struct tm* time) { @@ -164,12 +156,12 @@ normalize_struct_tm (struct tm* time) normalize_time_component (&(time->tm_sec), &(time->tm_min), 60, 0); normalize_time_component (&(time->tm_min), &(time->tm_hour), 60, 0); normalize_time_component (&(time->tm_hour), &(time->tm_mday), 24, 0); - normalize_month (&(time->tm_mon), &year); + normalize_time_component (&(time->tm_mon), &year, 12, 0); // auto month_in_range = []int (int m){ return (m + 12) % 12; } while (time->tm_mday < 1) { - normalize_month (&(--time->tm_mon), &year); + normalize_time_component (&(--time->tm_mon), &year, 12, 0); last_day = gnc_date_get_last_mday (time->tm_mon, year); time->tm_mday += last_day; } @@ -177,7 +169,7 @@ normalize_struct_tm (struct tm* time) while (time->tm_mday > last_day) { time->tm_mday -= last_day; - normalize_month(&(++time->tm_mon), &year); + normalize_time_component(&(++time->tm_mon), &year, 12, 0); last_day = gnc_date_get_last_mday (time->tm_mon, year); } time->tm_year = year - 1900;