projects
/
sleepy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d994ec4
)
allow suppressing next suspend
master
author
Jann Horn
<jann@thejh.net>
Wed, 8 Jul 2015 09:05:01 +0000
(11:05 +0200)
committer
Jann Horn
<jann@thejh.net>
Wed, 8 Jul 2015 09:05:01 +0000
(11:05 +0200)
sleepy.c
patch
|
blob
|
history
diff --git
a/sleepy.c
b/sleepy.c
index
7c871e8
..
4f78424
100644
(file)
--- a/
sleepy.c
+++ b/
sleepy.c
@@
-1,7
+1,22
@@
#include <time.h>
#include <time.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+time_t last;
+
+void keep_running(int _) {
+ time(&last);
+ puts("\nmarching on...");
+}
int main(void) {
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);
while(1) {
sleep(30);
time_t unixtime = time(NULL);