From e8209ef9adb9287fff080605ea863c576a276d03 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 2 Mar 2019 18:39:38 +0000 Subject: print time --- src/standalone.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/standalone.cpp b/src/standalone.cpp index 19b2f51..d47448d 100644 --- a/src/standalone.cpp +++ b/src/standalone.cpp @@ -107,6 +107,7 @@ #include #include #include +#include #include "../include/Gobbledegook.h" @@ -214,7 +215,11 @@ int dataSetter(const char *pName, const void *pData) LogDebug((std::string("Server data: setting ")+strName).c_str()); // the server can only receive a temperature reading, let's print it const char* strData = static_cast(pData); - std::cout << strData << std::endl; + std::time_t now = std::time(0); + char str_now[100]; + std::strftime(str_now,sizeof(str_now),"%Y-%m-%d %H:%M:%S",std::gmtime(&now)); + + std::cout << str_now << " " << strData << std::endl; return 1; } -- cgit v1.2.3