]> gitweb.hhaalo.de Git - feierabend.git/commitdiff
fix end worktime calc
authorBastian Dehn <hhaalo@arcor.de>
Tue, 7 Jul 2026 17:36:29 +0000 (19:36 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 7 Jul 2026 17:36:29 +0000 (19:36 +0200)
src/worktime.c
tests/worktime_tests.c

index 46faa4678a3cc653068a7696400c4e8ba1c42a39..90fcaaa2623caf861aa6e69bf310f3c9be56969d 100644 (file)
@@ -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;
 }
index 96eb2d4ba50f88b8de8cb0a9c7a46ea311683c1b..394f1a0692e6ccf63e81959d44ae7f046dc97cc1 100644 (file)
@@ -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()
 {