Minor refactoring
This commit is contained in:
parent
8c03ec3bdb
commit
b3acc92c1b
1 changed files with 8 additions and 8 deletions
16
stt.c
16
stt.c
|
|
@ -300,21 +300,21 @@ timesnode_print(struct timesnode * p, time_t aftertime, time_t beforetime, int s
|
||||||
printf("ended at: %s", ctime(&p->endtime));
|
printf("ended at: %s", ctime(&p->endtime));
|
||||||
|
|
||||||
duration = difftime(p->endtime, p->starttime) / 3600.0;
|
duration = difftime(p->endtime, p->starttime) / 3600.0;
|
||||||
duration = roundf(100.0 * duration) / 100.0;
|
|
||||||
|
|
||||||
printf("duration(hours): %.2f\n\n", duration);
|
|
||||||
} else {
|
} else {
|
||||||
nowtime = malloc(sizeof(time_t));
|
|
||||||
time(nowtime);
|
|
||||||
printf("still running\n");
|
printf("still running\n");
|
||||||
|
|
||||||
duration = difftime(*nowtime, p->starttime) / 3600.0;
|
nowtime = malloc(sizeof(time_t));
|
||||||
duration = roundf(100.0 * duration) / 100.0;
|
time(nowtime);
|
||||||
|
|
||||||
|
duration = difftime(*nowtime, p->starttime) / 3600.0;
|
||||||
|
|
||||||
printf("duration(hours): %.2f\n\n", duration);
|
|
||||||
free(nowtime);
|
free(nowtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
duration = roundf(100.0 * duration) / 100.0;
|
||||||
|
|
||||||
|
printf("duration(hours): %.2f\n\n", duration);
|
||||||
|
|
||||||
totalDuration += duration;
|
totalDuration += duration;
|
||||||
}
|
}
|
||||||
if (p->right != NULL) {
|
if (p->right != NULL) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue