commit 59aad7bea1837109ab85a9256a4ccf7d463e2629 parent 5afaee0b5c09dc1ba561780728e95399dc30e477 Author: Jacob R. Edwards <jacob@jacobedwards.org> Date: Mon, 1 Apr 2024 21:03:10 -0700 Fix getduration function Guess it didn't with my last change. Whoops. Diffstat:
M | times.c | | | 15 | ++++++++------- |
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/times.c b/times.c @@ -192,15 +192,16 @@ getduration(struct timesheet *ts) o = 0; s = ts->times[StartTime]; - if (ts->set & EndTimeFlag) { + if (ts->set & EndTimeFlag) e = ts->times[EndTime]; - } else if (!(ts->set & BreakStartTime)) { + else e = time(NULL); - } else if (ts->set & BreakEndTimeFlag) { - o = ts->times[BreakEndTime] - ts->times[BreakStartTime]; - e = time(NULL); - } else { - e = ts->times[BreakStartTime]; + + if (ts->set & BreakStartTimeFlag) { + if (ts->set & BreakEndTimeFlag) + o = ts->times[BreakEndTime] - ts->times[BreakStartTime]; + else + e = ts->times[BreakStartTime]; } return e - s - o;