diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index de66526c..103c3863 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -1115,7 +1115,6 @@ PROGMEM const char* const custom_reset_string[] = { #define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib) #endif - // ----------------------------------------------------------------------------- // ALEXA // ----------------------------------------------------------------------------- diff --git a/code/espurna/ntp.ino b/code/espurna/ntp.ino index a21e312b..5118c7fe 100644 --- a/code/espurna/ntp.ino +++ b/code/espurna/ntp.ino @@ -129,10 +129,8 @@ bool ntpSynced() { return (year() > 2017); } -String ntpDateTime() { - if (!ntpSynced()) return String(); +String ntpDateTime(time_t t) { char buffer[20]; - time_t t = now(); snprintf_P(buffer, sizeof(buffer), PSTR("%04d-%02d-%02d %02d:%02d:%02d"), year(t), month(t), day(t), hour(t), minute(t), second(t) @@ -140,6 +138,11 @@ String ntpDateTime() { return String(buffer); } +String ntpDateTime() { + if (ntpSynced()) return ntpDateTime(now()); + return String(); +} + // ----------------------------------------------------------------------------- void ntpSetup() {