summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2019-12-08 22:50:08 +1030
committerDaniel Jones <admin@danieljon.es>2019-12-08 22:50:08 +1030
commitd4895beb08fff1f173c58bbebe1be2e1b4c3a9ff (patch)
treeec53e0b9f890b425d6a5a68746e11797b6810895
parent634f35dcc34c4a22c08402a1fae0a3b045ec2d79 (diff)
downloadbinstatus-d4895beb08fff1f173c58bbebe1be2e1b4c3a9ff.tar.gz
binstatus-d4895beb08fff1f173c58bbebe1be2e1b4c3a9ff.zip
remove silly switch case for converting hours
-rw-r--r--binstatus.c18
1 files changed, 1 insertions, 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