diff options
| author | Mattias Andrée <maandree@kth.se> | 2021-03-25 18:26:07 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2021-03-25 18:26:07 +0100 |
| commit | 9e8f3dec7c4332a1e316b485ae9a3132aed7c6d9 (patch) | |
| tree | ed0c76b76943b08cee1afed9046f5604a6879f34 | |
| parent | Add clock (diff) | |
| download | pdatools-9e8f3dec7c4332a1e316b485ae9a3132aed7c6d9.tar.gz pdatools-9e8f3dec7c4332a1e316b485ae9a3132aed7c6d9.tar.bz2 pdatools-9e8f3dec7c4332a1e316b485ae9a3132aed7c6d9.tar.xz | |
stopwatch: add lap counter
Signed-off-by: Mattias Andrée <maandree@kth.se>
| -rw-r--r-- | stopwatch.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/stopwatch.c b/stopwatch.c index 19aba4f..8d5b783 100644 --- a/stopwatch.c +++ b/stopwatch.c @@ -29,6 +29,7 @@ display_stopwatch(int timerfd) uintmax_t total_overrun = 0, h, m, s, d, first_overrun = 0; int paused = 0, have_first = 0; struct itimerspec old_time, zero_time; + size_t lap = 1; ssize_t r; char c; @@ -68,7 +69,8 @@ display_stopwatch(int timerfd) h = total_overrun / 10 / 60 / 60; if (quadsize) printf("\033#5"); - printf("%ju:%02ju:%02ju.%ju", h, m, s, d); + printf("Lap %2zu: %ju:%02ju:%02ju.%ju", lap, h, m, s, d); + lap++; if (!have_first) { have_first = 1; first_overrun = total_overrun; |
