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;
}
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");
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
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
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);
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);
}
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);
}