Implement clockloop utility
[khome.git] / src / clockloop.c
diff --git a/src/clockloop.c b/src/clockloop.c
new file mode 100644 (file)
index 0000000..c9e04de
--- /dev/null
@@ -0,0 +1,28 @@
+#include <time.h>
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <ncurses.h>
+
+
+#define BS 50
+
+
+int
+main()
+{
+       time_t t;
+       char buf[BS];
+
+       initscr();
+       timeout(0);
+       while (getch() == -1) {
+               t = time(NULL);
+               strftime(buf, BS, "%A %Y-%m-%d %H:%M:%S", localtime(&t));
+               mvprintw(0, 0, "%s", buf);
+               refresh();
+       }
+       endwin();
+       return 0;
+}
This page took 0.031312 seconds and 4 git commands to generate.