From 7b04657a63a4a53ab33eaf071ba7fff4d110fcb6 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Tue, 9 Jun 2026 19:30:43 +0200 Subject: [PATCH] fix line length worktime calc --- src/feierabend.c | 9 ++++++--- src/worktime.c | 4 ++-- src/worktime.h | 4 ++-- src/xml.c | 2 +- tests/worktime_tests.c | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/feierabend.c b/src/feierabend.c index f87c686..472a6f7 100644 --- a/src/feierabend.c +++ b/src/feierabend.c @@ -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 [ ]\n", argv[0]); + printf("ERROR: %s %s %s\n", + argv[0], + " ", + "[ ]"); 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"); diff --git a/src/worktime.c b/src/worktime.c index 56734db..46faa46 100644 --- a/src/worktime.c +++ b/src/worktime.c @@ -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 diff --git a/src/worktime.h b/src/worktime.h index 83f3379..2096448 100644 --- a/src/worktime.h +++ b/src/worktime.h @@ -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 diff --git a/src/xml.c b/src/xml.c index 46fc164..6a0ae9d 100644 --- 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); diff --git a/tests/worktime_tests.c b/tests/worktime_tests.c index d78c4ea..9e35726 100644 --- a/tests/worktime_tests.c +++ b/tests/worktime_tests.c @@ -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); } -- 2.47.3