From 53843c9613c5c6fe6513b6383c018b798e79277f Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Fri, 20 Jan 2017 00:06:28 -0500 Subject: Modulo next hour by 24 in clock --- .bin/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit 1.4.1