diff --git a/stt.c b/stt.c index c33ec7e..5aa1a8c 100644 --- a/stt.c +++ b/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)); duration = difftime(p->endtime, p->starttime) / 3600.0; - duration = roundf(100.0 * duration) / 100.0; - - printf("duration(hours): %.2f\n\n", duration); } else { - nowtime = malloc(sizeof(time_t)); - time(nowtime); printf("still running\n"); - duration = difftime(*nowtime, p->starttime) / 3600.0; - duration = roundf(100.0 * duration) / 100.0; + nowtime = malloc(sizeof(time_t)); + time(nowtime); + + duration = difftime(*nowtime, p->starttime) / 3600.0; - printf("duration(hours): %.2f\n\n", duration); free(nowtime); } + duration = roundf(100.0 * duration) / 100.0; + + printf("duration(hours): %.2f\n\n", duration); + totalDuration += duration; } if (p->right != NULL) {