From d994ec4befe1c44c321463d9892fe351f69bb9dc Mon Sep 17 00:00:00 2001 From: Jann Horn Date: Tue, 7 Jul 2015 16:06:53 +0200 Subject: [PATCH 1/1] initial --- .gitignore | 1 + sleepy.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 .gitignore create mode 100644 sleepy.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..12136b4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +sleepy diff --git a/sleepy.c b/sleepy.c new file mode 100644 index 0000000..7c871e8 --- /dev/null +++ b/sleepy.c @@ -0,0 +1,15 @@ +#include + +int main(void) { + time_t last = 0; + while(1) { + sleep(30); + time_t unixtime = time(NULL); + if (unixtime - last < 300) continue; + struct tm *t = localtime(&unixtime); + if (t->tm_hour >= 5 && t->tm_hour != 23) continue; + if (t->tm_min % 15 != 0) continue; + system("sstandby"); + last = unixtime; + } +} -- 2.20.1