timestr = NULL;
}
+struct tm get_tm_from_time(const time_t time)
+{
+ struct tm tm_value;
+ const struct tm* time_tm = localtime(&time);
+ memcpy(&tm_value, time_tm, sizeof(struct tm));
+
+ return tm_value;
+}
+
int main(int argc, const char* argv[])
{
if (argc < 3 || (argc > 3 && argc < 5)) {
const time_t begin = mktime(&begin_tm);
const time_t end = mktime(&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* tmp_work_eight_end = localtime(&worktime_eight_end);
- struct tm work_eight_end_tm;
- memcpy(&work_eight_end_tm, tmp_work_eight_end, sizeof(struct tm));
-
- const struct tm* tmp_max_work_end = localtime(&worktime_max_end);
- struct tm max_work_end_tm;
- memcpy(&max_work_end_tm, tmp_max_work_end, sizeof(struct tm));
+ 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);
_print_time_now(end_tm);
printf("\n");