|
@ -129,10 +129,8 @@ bool ntpSynced() { |
|
|
return (year() > 2017); |
|
|
return (year() > 2017); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
String ntpDateTime() { |
|
|
|
|
|
if (!ntpSynced()) return String(); |
|
|
|
|
|
|
|
|
String ntpDateTime(time_t t) { |
|
|
char buffer[20]; |
|
|
char buffer[20]; |
|
|
time_t t = now(); |
|
|
|
|
|
snprintf_P(buffer, sizeof(buffer), |
|
|
snprintf_P(buffer, sizeof(buffer), |
|
|
PSTR("%04d-%02d-%02d %02d:%02d:%02d"), |
|
|
PSTR("%04d-%02d-%02d %02d:%02d:%02d"), |
|
|
year(t), month(t), day(t), hour(t), minute(t), second(t) |
|
|
year(t), month(t), day(t), hour(t), minute(t), second(t) |
|
@ -140,6 +138,11 @@ String ntpDateTime() { |
|
|
return String(buffer); |
|
|
return String(buffer); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String ntpDateTime() { |
|
|
|
|
|
if (ntpSynced()) return ntpDateTime(now()); |
|
|
|
|
|
return String(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
void ntpSetup() { |
|
|
void ntpSetup() { |
|
|