[Zrouter-src] ZRouter.org: push to zconf++ zconf++/platform/posix.cc

zrouter-src at zrouter.org zrouter-src at zrouter.org
Mon Jan 9 00:34:35 UTC 2012


details:   /rev/e823a99c2d86
changeset: 29:e823a99c2d86
user:      "Nicolai Petri <nicolai at petri.dk>"
date:      Mon Jan 09 01:31:04 2012 +0100
description:
Add system.boottime

diffstat:

 zconf++/platform/posix.cc |  6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (23 lines):

diff -r 22b5670a571b -r e823a99c2d86 zconf++/platform/posix.cc
--- a/zconf++/platform/posix.cc	Thu Dec 15 08:52:36 2011 +0100
+++ b/zconf++/platform/posix.cc	Mon Jan 09 01:31:04 2012 +0100
@@ -32,6 +32,7 @@
 	#include <sys/sysctl.h>
 	#include <err.h>
 	#include <unistd.h>
+	#include <time.h>
 }
 
 #include "../zextension.h"
@@ -57,6 +58,11 @@
 		ZExtensionManager::register_extension("Platform::Posix", extension_init);
 	}
 	static bool extension_init(boost::asio::io_service &io, Model &model) {
+		struct timespec curtime;
+		struct timespec uptime;
+		clock_gettime(CLOCK_REALTIME_FAST, &curtime); 
+		clock_gettime(CLOCK_UPTIME_FAST, &uptime); 
+		model["system"]["boottime"] = curtime.tv_sec - uptime.tv_sec;
 		model["system"]["hostname"]=getHostname();
 		//model["system"]["extensions"]["Platform_Posix_Module"]["vendor"]="ZRouter.org";
 		return true;


More information about the Zrouter-src mailing list