From 69ce0a0d9317af896e2f24a0c0711945ef32c52e Mon Sep 17 00:00:00 2001 From: jasonev Date: Thu, 30 Mar 2023 16:28:36 -0700 Subject: [PATCH] Added hourChanged() --- src/ezTime.cpp | 5 +++++ src/ezTime.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/ezTime.cpp b/src/ezTime.cpp index 78d4399..72825cf 100644 --- a/src/ezTime.cpp +++ b/src/ezTime.cpp @@ -370,6 +370,11 @@ namespace ezt { return false; } + bool hourChanged() { + time_t t = nowUTC(false); + if (_last_read_t / 60 / 60 != t / 60 / 60) return true; + return false; + } #ifdef EZTIME_NETWORK_ENABLE diff --git a/src/ezTime.h b/src/ezTime.h index d849847..e0b1f52 100644 --- a/src/ezTime.h +++ b/src/ezTime.h @@ -197,6 +197,7 @@ namespace ezt { timeStatus_t timeStatus(); String urlEncode(const String str); String zeropad(const uint32_t number, const uint8_t length); + bool hourChanged(); #ifdef EZTIME_NETWORK_ENABLE bool queryNTP(const String server, time_t &t, unsigned long &measured_at);