summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2017-01-20 00:06:28 -0500
committerJune McEnroe <programble@gmail.com>2017-01-20 00:06:28 -0500
commit7a2d8a9538c1eb6df4dd305a20aa42ee11b2edeb (patch)
tree95faea967ec31415c4225b16a405a8aa260135b4
parentSwitch clock to 6-minute graduations (diff)
downloadsrc-7a2d8a9538c1eb6df4dd305a20aa42ee11b2edeb.tar.gz
src-7a2d8a9538c1eb6df4dd305a20aa42ee11b2edeb.zip
Modulo next hour by 24 in clock
-rwxr-xr-x.bin/clock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/.bin/clock.c b/.bin/clock.c
index 9fcd5ac9..d513fe75 100755
--- a/.bin/clock.c
+++ b/.bin/clock.c
@@ -15,7 +15,7 @@ int main() {
     if (!clock) err(EX_OSERR, "localtime");
 
     int hour = clock->tm_hour;
-    int next = clock->tm_hour + 1;
+    int next = (hour + 1) % 24;
 
     switch ((clock->tm_min + 3) / 6) {
         case  0: printf("....%02d....\n", hour); break;