From c47cb5b7a8854d409bf851c8d406a70fe404b021 Mon Sep 17 00:00:00 2001 From: marcellus Date: Mon, 15 Apr 2024 11:10:37 +0200 Subject: init: initial commit --- Makefile | 12 ++++++++++++ cswatch.c | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Makefile create mode 100644 cswatch.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b0b7e6c --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +CFLAGS = -Wall -Wextra + +cswatch: cswatch.c + +install: cswatch + sudo cp cswatch /usr/bin + +clean: + rm cswatch + +uninstall: clean + rm /usr/bin/cswatch diff --git a/cswatch.c b/cswatch.c new file mode 100644 index 0000000..7d1103f --- /dev/null +++ b/cswatch.c @@ -0,0 +1,21 @@ +#include +#include +#include + +int main(void) +{ + time_t curtime; + struct tm* utctime; + double swatchTime; + + curtime = time(NULL); + utctime = gmtime(&curtime); + + swatchTime = (((utctime->tm_hour + 1) % 24) * 60 + + utctime->tm_min) * 60 + utctime->tm_sec; + swatchTime /= 84.6; + + printf("%3.2f", swatchTime); + + return EXIT_SUCCESS; +} -- cgit v1.2.3