From d74153266445d39d00f8f9466c3db8d62cadbf46 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 19 Jan 2017 23:30:24 -0500 Subject: Switch clock to 6-minute graduations --- .bin/clock.c | 23 +++++++++++++++-------- 1 file 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(×tamp); 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; -- cgit 1.4.1 ion value='committer'>committer
path: root/etc/Light.terminal (unfollow)
Commit message (Collapse)Author
2019-01-10Reference cash-specific builtin man pagesJune McEnroe
2019-01-10Create cash-printf.1June McEnroe
2019-01-10Create cash-test.1June McEnroe
2019-01-10Create cash-kill.1June McEnroe
2019-01-10Create cash.1June McEnroe