chiark / gitweb /
When recording dial time, write "12" instead of "0" for the hour.
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 24 Nov 2018 10:38:07 +0000 (10:38 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Sat, 8 Dec 2018 22:30:09 +0000 (22:30 +0000)
12-hour clocks are generally thought of a running from 1 to 12, not
from 0 to 11.

clunk.c

diff --git a/clunk.c b/clunk.c
index 853299d359ed57180d7f56b64dbd0f2002092af6..868a5c8502266d127578fbfb5c524ea7ad848512 100644 (file)
--- a/clunk.c
+++ b/clunk.c
@@ -103,8 +103,9 @@ record_tick(void)
                 * simple case like this.
                 */
                printed = snprintf(statebuf, 10, "%2d:%02d:%02d\n",
-                                  displayed.tm_hour, displayed.tm_min,
-                                  displayed.tm_sec);
+                                  displayed.tm_hour == 0 ?
+                                  12 : displayed.tm_hour,
+                                  displayed.tm_min, displayed.tm_sec);
                assert(printed == 9);
                stateaio.aio_fildes = statefd;
                stateaio.aio_buf = statebuf;