From d4895beb08fff1f173c58bbebe1be2e1b4c3a9ff Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Sun, 8 Dec 2019 22:50:08 +1030 Subject: remove silly switch case for converting hours --- binstatus.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/binstatus.c b/binstatus.c index 9b29c29..edce1ec 100644 --- a/binstatus.c +++ b/binstatus.c @@ -59,23 +59,7 @@ formatstring(char *status, int *time) int converthour(int hour) { - // is there a better way? - switch (hour) - { - case 0: return 12; - case 13: return 1; - case 14: return 2; - case 15: return 3; - case 16: return 4; - case 17: return 5; - case 18: return 6; - case 19: return 7; - case 20: return 8; - case 21: return 9; - case 22: return 10; - case 23: return 11; - default: return hour; - } + return (hour - 12 < 0) ? 0 : hour - 12; } int -- cgit v1.2.3