]> gitweb.hhaalo.de Git - feierabend.git/commitdiff
change order to calc
authorBastian Dehn <hhaalo@arcor.de>
Sat, 14 Feb 2026 13:20:57 +0000 (14:20 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 14 Feb 2026 13:20:57 +0000 (14:20 +0100)
src/feierabend.c

index 90da2e07116844e434f6b085d8637ba830f99406..6a3f1c3ba1f1ee27cc60aead461be7b2b651dfe5 100644 (file)
@@ -140,22 +140,22 @@ int main(int argc, const char* argv[])
 
        printf("Version: %s\n\n", PROJECT_VERSION);
 
+       const struct tm now_tm = _init_tm_with_time(NULL, NULL);
+       const time_t now = mktime((struct tm*) &now_tm);
        const struct tm begin_tm = _init_tm_with_time(argv[1], argv[2]);
-       const struct tm end_tm = _init_tm_with_time(NULL, NULL);
        const time_t begin = mktime((struct tm*) &begin_tm);
-       const time_t end = mktime((struct tm*) &end_tm);
        const time_t worktime_eight_end = get_eight_hour_end_worktime(begin);
-       const time_t worktime_max_end = get_ten_hour_end_worktime(begin);
        const struct tm work_eight_end_tm = _get_tm_from_time(worktime_eight_end);
+       const time_t worktime_max_end = get_ten_hour_end_worktime(begin);
        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 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, end);
-       const time_t diff_to_max_end = get_current_worktime_diff_to_end_ten_hour(begin, end);
+       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);
 
-       _print_time_now(end_tm);
+       _print_time_now(now_tm);
        printf("\n");
 
        _print_work_begin(begin_tm);