]> gitweb.hhaalo.de Git - feierabend.git/commitdiff
change calc all on top main
authorBastian Dehn <hhaalo@arcor.de>
Sat, 14 Feb 2026 13:12:31 +0000 (14:12 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 14 Feb 2026 13:12:31 +0000 (14:12 +0100)
src/feierabend.c

index 148253f421c69bd34fa0f9813d2e7319dda9b1b4..90da2e07116844e434f6b085d8637ba830f99406 100644 (file)
@@ -53,19 +53,17 @@ void _print_max_work_end(const struct tm max_work_end_tm)
        printf("\n");
 }
 
-void _print_brutto_worktime(const time_t begin, const time_t end)
+void _print_brutto_worktime(const time_t brutto_worktime)
 {
-       const time_t butto_worktime = get_brutto_worktime(begin, end);
-       char* timestr = get_time_str(butto_worktime);
+       char* timestr = get_time_str(brutto_worktime);
        printf("%-26s%6s\n", "Brutto Arbeitzeit:", timestr);
 
        free(timestr);
        timestr = NULL;
 }
 
-void _print_netto_worktime(const time_t begin, const time_t end)
+void _print_netto_worktime(const time_t netto_worktime)
 {
-       const time_t netto_worktime = get_current_worktime(begin, end);
        char* timestr = get_time_str(netto_worktime);
        printf("%-26s%6s\n", "Netto Arbeitzeit:", timestr);
 
@@ -73,10 +71,8 @@ void _print_netto_worktime(const time_t begin, const time_t end)
        timestr = NULL;
 }
 
-void _print_current_breaktime(const time_t begin, const time_t end)
+void _print_current_breaktime(const time_t break_time)
 {
-       const time_t brutto_worktime = get_brutto_worktime(begin, end);
-       const time_t break_time = get_break_time(brutto_worktime);
        char* timestr = get_time_str(break_time);
        printf("%-26s%6s\n", "Aktuelle Pausenzeit:", timestr);
 
@@ -84,9 +80,8 @@ void _print_current_breaktime(const time_t begin, const time_t end)
        timestr = NULL;
 }
 
-void _print_time_to_end_worktime(const time_t begin, const time_t end)
+void _print_time_to_end_worktime(const time_t diff_to_end)
 {
-       const time_t diff_to_end = get_current_worktime_diff_to_end_eight_hour(begin, end);
        char* timestr = get_time_str(diff_to_end);
        printf("Arbeitzeit bis %02d:%02d Std: %6s\n",
                SOLL_HOUR,
@@ -97,10 +92,9 @@ void _print_time_to_end_worktime(const time_t begin, const time_t end)
        timestr = NULL;
 }
 
-void _print_time_to_max_end_worktime(const time_t begin, const time_t end)
+void _print_time_to_max_end_worktime(const time_t diff_to_max_end)
 {
-       const time_t diff_to_end = get_current_worktime_diff_to_end_ten_hour(begin, end);
-       char* timestr = get_time_str(diff_to_end);
+       char* timestr = get_time_str(diff_to_max_end);
        printf("Arbeitzeit bis 10:00 Std: %6s\n", timestr);
 
        free(timestr);
@@ -155,6 +149,12 @@ int main(int argc, const char* argv[])
        const struct tm work_eight_end_tm = _get_tm_from_time(worktime_eight_end);
        const struct tm max_work_end_tm = _get_tm_from_time(worktime_max_end);
 
+       const time_t netto_worktime = get_current_worktime(begin, end);
+       const time_t brutto_worktime = get_brutto_worktime(begin, end);
+       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, end);
+       const time_t diff_to_max_end = get_current_worktime_diff_to_end_ten_hour(begin, end);
+
        _print_time_now(end_tm);
        printf("\n");
 
@@ -163,13 +163,13 @@ int main(int argc, const char* argv[])
        _print_max_work_end(max_work_end_tm);
        printf("\n");
 
-       _print_brutto_worktime(begin, end);
-       _print_netto_worktime(begin, end);
-       _print_current_breaktime(begin, end);
+       _print_brutto_worktime(brutto_worktime);
+       _print_netto_worktime(netto_worktime);
+       _print_current_breaktime(break_time);
        printf("\n");
 
-       _print_time_to_end_worktime(begin, end);
-       _print_time_to_max_end_worktime(begin, end);
+       _print_time_to_end_worktime(diff_to_end);
+       _print_time_to_max_end_worktime(diff_to_max_end);
 
        return 0;
 }
\ No newline at end of file