Browse Source

Option to report time even if no NTP sync (#1310)

alexa
Xose Pérez 5 years ago
parent
commit
7ab5b04fff
2 changed files with 9 additions and 1 deletions
  1. +4
    -0
      code/espurna/config/general.h
  2. +5
    -1
      code/espurna/ntp.ino

+ 4
- 0
code/espurna/config/general.h View File

@ -1088,6 +1088,10 @@
#define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib) #define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib)
#endif #endif
#ifndef NTP_WAIT_FOR_SYNC
#define NTP_WAIT_FOR_SYNC 1 // Do not report any datetime until NTP sync'ed
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// ALEXA // ALEXA
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


+ 5
- 1
code/espurna/ntp.ino View File

@ -128,7 +128,11 @@ void _ntpBackwards() {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool ntpSynced() { bool ntpSynced() {
return (NTP.getLastNTPSync() > 0);
#if NTP_WAIT_FOR_SYNC
return (NTP.getLastNTPSync() > 0);
#else
return true;
#endif
} }
String ntpDateTime(time_t t) { String ntpDateTime(time_t t) {


Loading…
Cancel
Save