summary refs log tree commit diff
path: root/.bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2017-01-19 23:30:24 -0500
committerJune McEnroe <june@causal.agency>2017-01-19 23:30:24 -0500
commitbe8bc53a899b72071b6b74fb2992a26fbc6b3476 (patch)
tree0d0a729c71d30351b3f28fa9d6c1ae7b6a40f356 /.bin
parentRevert "Show one digit of each hour in clock" (diff)
downloadsrc-be8bc53a899b72071b6b74fb2992a26fbc6b3476.tar.gz
src-be8bc53a899b72071b6b74fb2992a26fbc6b3476.zip
Switch clock to 6-minute graduations
Diffstat (limited to '.bin')
-rwxr-xr-x.bin/clock.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/.bin/clock.c b/.bin/clock.c
index 9eb4dc23..9fcd5ac9 100755
--- a/.bin/clock.c
+++ b/.bin/clock.c
@@ -14,14 +14,21 @@ int main() {
     struct tm *clock = localtime(&timestamp);
     if (!clock) err(EX_OSERR, "localtime");
 
-    switch ((clock->tm_min + 5) / 10) {
-        case 0: printf("...%02d...\n", clock->tm_hour); break;
-        case 1: printf("..%02d....\n", clock->tm_hour); break;
-        case 2: printf(".%02d.....\n", clock->tm_hour); break;
-        case 3: printf("%02d....%02d\n", clock->tm_hour, clock->tm_hour + 1); break;
-        case 4: printf(".....%02d.\n", clock->tm_hour + 1); break;
-        case 5: printf("....%02d..\n", clock->tm_hour + 1); break;
-        case 6: printf("...%02d...\n", clock->tm_hour + 1); break;
+    int hour = clock->tm_hour;
+    int next = clock->tm_hour + 1;
+
+    switch ((clock->tm_min + 3) / 6) {
+        case  0: printf("....%02d....\n", hour); break;
+        case  1: printf("...%02d.....\n", hour); break;
+        case  2: printf("..%02d......\n", hour); break;
+        case  3: printf(".%02d.......\n", hour); break;
+        case  4: printf("%02d........\n", hour); break;
+        case  5: printf("%d........%d\n", hour % 10, next / 10); break;
+        case  6: printf("........%02d\n", next); break;
+        case  7: printf(".......%02d.\n", next); break;
+        case  8: printf("......%02d..\n", next); break;
+        case  9: printf(".....%02d...\n", next); break;
+        case 10: printf("....%02d....\n", next); break;
     }
 
     return 0;
='2014-01-12 23:02:19 +0100'>2014-01-12ui-shared: URL-escape script_nameJohn Keeping 2014-01-12ui-refs: escape HTML chars in author and tagger namesJohn Keeping 2014-01-12filter: pass extra arguments via cgit_open_filterJohn Keeping 2014-01-12ui-snapshot: set unused cgit_filter fields to zeroJohn Keeping 2014-01-12html: remove redundant htmlfd variableJohn Keeping 2014-01-12tests: add Valgrind supportJohn Keeping 2014-01-12cache: don't leave cache_slot fields uninitializedJohn Keeping 2014-01-10filter: split filter functions into their own fileJason A. Donenfeld 2014-01-10filter: make exit status localJason A. Donenfeld 2014-01-10parsing: fix header typoJason A. Donenfeld 2014-01-10cgit.c: Fix comment on bit mask hackLukas Fleischer 2014-01-10cgit.c: Use "else" for mutually exclusive branchesLukas Fleischer 2014-01-10ui-snapshot.c: Do not reinvent suffixcmp()Lukas Fleischer 2014-01-10Refactor cgit_parse_snapshots_mask()Lukas Fleischer 2014-01-10Disallow use of undocumented snapshot delimitersLukas Fleischer 2014-01-10Replace most uses of strncmp() with prefixcmp()Lukas Fleischer 2014-01-09README: Fix dependenciesLukas Fleischer 2014-01-08README: Spelling and formatting fixesLukas Fleischer 2014-01-08Fix UTF-8 with syntax-highlighting.pyPřemysl Janouch 2014-01-08Add a suggestion to the manpagePřemysl Janouch 2014-01-08Fix the example configurationPřemysl Janouch 2014-01-08Fix about-formatting.shPřemysl Janouch 2014-01-08Fix some spelling errorsPřemysl Janouch 2014-01-08filters: highlight.sh: add css comments for highlight 2.6 and 3.8Ferry Huberts