From: Bastian Dehn Date: Tue, 7 Jul 2026 17:36:29 +0000 (+0200) Subject: fix end worktime calc X-Git-Tag: 1.3.25^2~1^2~2 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=68af5dfdab481df0969a61a2800637997f378878;p=feierabend.git fix end worktime calc --- diff --git a/src/worktime.c b/src/worktime.c index 46faa46..90fcaaa 100644 --- a/src/worktime.c +++ b/src/worktime.c @@ -30,7 +30,7 @@ time_t get_current_worktime(const time_t begin, const time_t now) time_t get_eight_hour_end_worktime(const time_t begin) { time_t worktime = begin + SOLL_WORKTIME; - worktime += get_break_time(worktime); + worktime += get_break_time(SOLL_WORKTIME); return worktime; } @@ -38,7 +38,7 @@ time_t get_eight_hour_end_worktime(const time_t begin) time_t get_ten_hour_end_worktime(const time_t begin) { time_t worktime = begin + TEN_HOURS; - worktime += get_break_time(worktime); + worktime += get_break_time(TEN_HOURS); return worktime; } diff --git a/tests/worktime_tests.c b/tests/worktime_tests.c index 96eb2d4..394f1a0 100644 --- a/tests/worktime_tests.c +++ b/tests/worktime_tests.c @@ -46,6 +46,24 @@ void get_diff_to_end_ten_hour_end_test() assert_int_equal(result, 21720); } + +void get_eigth_hour_end_time_test() +{ + const time_t begin = 23400; + + const time_t result = get_eight_hour_end_worktime(begin); + + assert_int_equal(result, 54900); +} + +void get_ten_hour_end_time_test() +{ + const time_t begin = 23400; + + const time_t result = get_ten_hour_end_worktime(begin); + + assert_int_equal(result, 62100); +} #endif #ifndef BEFORE_AUG_2026 @@ -88,7 +106,6 @@ void get_current_work_time_after_nine_hours_test() assert_int_equal(result, 29701); } -#endif void get_eigth_hour_end_time_test() { @@ -96,7 +113,7 @@ void get_eigth_hour_end_time_test() const time_t result = get_eight_hour_end_worktime(begin); - assert_int_equal(result, 54900); + assert_int_equal(result, 54000); } void get_ten_hour_end_time_test() @@ -107,6 +124,7 @@ void get_ten_hour_end_time_test() assert_int_equal(result, 62100); } +#endif void get_brutto_worktime_four_hours_fourty_five_test() {