diff options
author | June McEnroe <programble@gmail.com> | 2017-04-30 14:02:55 -0400 |
---|---|---|
committer | June McEnroe <programble@gmail.com> | 2017-04-30 14:02:55 -0400 |
commit | 00ac44f85d1c3d0762e7daa318b3cf8e976637dc (patch) | |
tree | 1e6908c20137ee43171d6c4adb1b0ccdc26684e3 | |
parent | Clean up error strings in bri (diff) | |
download | src-00ac44f85d1c3d0762e7daa318b3cf8e976637dc.tar.gz src-00ac44f85d1c3d0762e7daa318b3cf8e976637dc.zip |
Clean up clock
Diffstat (limited to '')
-rwxr-xr-x | .bin/clock.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/.bin/clock.c b/.bin/clock.c index f153126a..288884d8 100755 --- a/.bin/clock.c +++ b/.bin/clock.c @@ -10,16 +10,16 @@ exec cc -Wall -Wextra -pedantic $@ -o $(dirname $0)/clock $0 #include <err.h> int main() { - time_t timestamp = time(NULL); - if (timestamp < 0) err(EX_OSERR, "time"); + time_t ts = time(NULL); + if (ts < 0) err(EX_OSERR, "time"); - struct tm *clock = localtime(×tamp); - if (!clock) err(EX_OSERR, "localtime"); + struct tm *time = localtime(&ts); + if (!time) err(EX_OSERR, "localtime"); - int hour = clock->tm_hour; + int hour = time->tm_hour; int next = (hour + 1) % 24; - switch ((clock->tm_min + 5) / 10) { + switch ((time->tm_min + 5) / 10) { case 0: printf("..%02d..\n", hour); break; case 1: printf(".%02d...\n", hour); break; case 2: printf("%02d....\n", hour); break; @@ -29,5 +29,5 @@ int main() { case 6: printf("..%02d..\n", next); break; } - return 0; + return EX_OK; } |