X-Git-Url: http://git.thejh.net/?p=sleepy.git;a=blobdiff_plain;f=sleepy.c;h=4f7842497e574d1fe35fd991f2ea94743e7e561e;hp=7c871e842f1ccbc63366e901de11e7f5c373dfbd;hb=HEAD;hpb=d994ec4befe1c44c321463d9892fe351f69bb9dc diff --git a/sleepy.c b/sleepy.c index 7c871e8..4f78424 100644 --- a/sleepy.c +++ b/sleepy.c @@ -1,7 +1,22 @@ #include +#include +#include +#include +#include + +time_t last; + +void keep_running(int _) { + time(&last); + puts("\nmarching on..."); +} int main(void) { - time_t last = 0; + puts("stops roughly at 15-minute time boundaries"); + puts("CTRL+C for no stop in the next 5 minutes"); + puts("stop with ctrl+\\ (SIGQUIT)"); + signal(SIGQUIT, exit); + signal(SIGINT, keep_running); while(1) { sleep(30); time_t unixtime = time(NULL);