Module: check_mk
Branch: master
Commit: ff406deff55c53e7ef2014113529b9ef4f562ebb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ff406deff55c53…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Sep 17 12:17:37 2012 +0200
New small time computing helper for Windows (nowin.exe)
---
agents/windows/Makefile | 5 ++++-
agents/windows/nowin.cc | 24 ++++++++++++++++++++++++
agents/windows/nowin.exe | Bin 0 -> 22511 bytes
3 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/agents/windows/Makefile b/agents/windows/Makefile
index 31a2105..fb90e88 100755
--- a/agents/windows/Makefile
+++ b/agents/windows/Makefile
@@ -28,7 +28,7 @@ else
CXX = mingw32-g++
endif
-install_agent.exe: check_mk_agent.exe crash.exe
+install_agent.exe: check_mk_agent.exe crash.exe nowin.exe
if ! which makensis; then \
echo "ERROR: makensis missing. Please install the nsis package." ; \
exit 1 ; \
@@ -42,6 +42,9 @@ check_mk_agent.exe: check_mk_agent.cc Makefile
crash.exe: crash.cc Makefile
$(CXX) -o $@ $<
+nowin.exe: nowin.cc Makefile
+ $(CXX) -o $@ $<
+
clean:
rm -f *.o *~ svn-*.tmp
diff --git a/agents/windows/nowin.cc b/agents/windows/nowin.cc
new file mode 100644
index 0000000..1426286
--- /dev/null
+++ b/agents/windows/nowin.cc
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+int main(int argc, char **argv)
+{
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s MINUTES\n", argv[0]);
+ exit(1);
+ }
+ int minutes = atoi(argv[1]);
+ time_t now = time(0);
+ time_t then = now + minutes * 60;
+
+ struct tm *t;
+ char out[64];
+ t = localtime(&now);
+ strftime(out, sizeof(out), "%Y-%m-%d %H:%M", t);
+ printf("%s ", out);
+ t = localtime(&then);
+ strftime(out, sizeof(out), "%Y-%m-%d %H:%M", t);
+ printf("%s\n", out);
+}
+
diff --git a/agents/windows/nowin.exe b/agents/windows/nowin.exe
new file mode 100755
index 0000000..1aed146
Binary files /dev/null and b/agents/windows/nowin.exe differ