]> gitweb.hhaalo.de Git - feierabend.git/commitdiff
fix line length worktime calc
authorBastian Dehn <hhaalo@arcor.de>
Tue, 9 Jun 2026 17:30:43 +0000 (19:30 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 9 Jun 2026 17:48:58 +0000 (19:48 +0200)
src/feierabend.c
src/worktime.c
src/worktime.h
src/xml.c
tests/worktime_tests.c

index f87c686013094b806311f21f66029bf23fef3b58..472a6f7b6944f5b0593eca01516759287f8d81e1 100644 (file)
@@ -108,7 +108,10 @@ time_t _init_time_with_args(const char* hour, const char* min)
 
 int _few_arguments(const char* argv[])
 {
-       printf("ERROR: %s <begin_hours> <begin_minutes> [<end_hours> <end_minutes>]\n", argv[0]);
+       printf("ERROR: %s %s %s\n",
+               argv[0],
+               "<begin_hours> <begin_minutes>",
+               "[<end_hours> <end_minutes>]");
        return EXIT_FAILURE;
 }
 
@@ -163,8 +166,8 @@ int main(const int argc, const char* argv[])
        const time_t brutto_worktime = get_brutto_worktime(begin, now);
        const time_t netto_worktime = get_current_worktime(begin, now);
        const time_t break_time = get_break_time(brutto_worktime);
-       const time_t diff_to_end = get_current_worktime_diff_to_end_eight_hour(begin, now);
-       const time_t diff_to_max_end = get_current_worktime_diff_to_end_ten_hour(begin, now);
+       const time_t diff_to_end = get_diff_to_soll_end(begin, now);
+       const time_t diff_to_max_end = get_diff_to_max_end(begin, now);
 
        _print_long_date_time(CURRENT_TIME, now);
        printf("\n");
index 56734db22dc480e6cbb113edc5b3dd4d076c781a..46faa4678a3cc653068a7696400c4e8ba1c42a39 100644 (file)
@@ -43,12 +43,12 @@ time_t get_ten_hour_end_worktime(const time_t begin)
        return worktime;
 }
 
-time_t get_current_worktime_diff_to_end_eight_hour(const time_t begin, const time_t now)
+time_t get_diff_to_soll_end(const time_t begin, const time_t now)
 {
        return SOLL_WORKTIME - get_current_worktime(begin, now);
 }
 
-time_t get_current_worktime_diff_to_end_ten_hour(const time_t begin, const time_t now)
+time_t get_diff_to_max_end(const time_t begin, const time_t now)
 {
        return TEN_HOURS - get_current_worktime(begin, now);
 }
\ No newline at end of file
index 83f3379c68ff61ec6f76e193be9e189108adcf20..2096448bf5580c562979e89c269d2ec5a024ccfd 100644 (file)
@@ -11,7 +11,7 @@ time_t get_brutto_worktime(const time_t begin, const time_t now);
 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 get_ten_hour_end_worktime(const time_t begin);
-time_t get_current_worktime_diff_to_end_eight_hour(const time_t begin, const time_t now);
-time_t get_current_worktime_diff_to_end_ten_hour(const time_t begin, const time_t now);
+time_t get_diff_to_soll_end(const time_t begin, const time_t now);
+time_t get_diff_to_max_end(const time_t begin, const time_t now);
 
 #endif
\ No newline at end of file
index 46fc1649e57d156f77b5734109ffa8931f42aa73..6a0ae9d3e52e2403debac2cacabe6f8566848364 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -243,7 +243,7 @@ void _write_entry_node(xmlTextWriterPtr xmlWriter,
        const time_t end = mktime((struct tm*) &end_tm);
        const time_t brutto_worktime = get_brutto_worktime(begin, end);
        const time_t netto_worktime = get_current_worktime(begin, end);
-       const time_t overtime = get_current_worktime_diff_to_end_eight_hour(begin, end);
+       const time_t overtime = get_diff_to_soll_end(begin, end);
        const time_t breaktime = get_break_time(brutto_worktime);
        const time_t updated_saldo = last_saldo + (overtime * -1);
 
index d78c4eabd179ea01901425a4782d114aa4268da7..9e357263fb4e6d7e104f42b965dc6d25e2d9d9f1 100644 (file)
@@ -69,7 +69,7 @@ void get_diff_to_end_eight_hour_end_test()
        const time_t begin = 23400;
        const time_t now = 38580;
 
-       const time_t result = get_current_worktime_diff_to_end_eight_hour(begin, now);
+       const time_t result = get_diff_to_soll_end(begin, now);
 
        assert_int_equal(result, 14520);
 }
@@ -79,7 +79,7 @@ void get_diff_to_end_ten_hour_end_test()
        const time_t begin = 23400;
        const time_t now = 38580;
 
-       const time_t result = get_current_worktime_diff_to_end_ten_hour(begin, now);
+       const time_t result = get_diff_to_max_end(begin, now);
 
        assert_int_equal(result, 21720);
 }