extracte time stuff, started logger

This commit is contained in:
Your Name
2021-07-01 21:19:51 +02:00
parent a1f2388c7f
commit f1d55ed603
5 changed files with 87 additions and 35 deletions

18
esp32/src/TimeUtils.cpp Normal file
View File

@@ -0,0 +1,18 @@
#include "TimeUtils.h"
#include <Homie.h>
long getCurrentTime()
{
struct timeval tv_now;
gettimeofday(&tv_now, NULL);
return tv_now.tv_sec;
}
int getCurrentHour()
{
struct tm info;
time_t now;
time(&now);
localtime_r(&now, &info);
return info.tm_hour;
}