-
Notifications
You must be signed in to change notification settings - Fork 1
/
ntp.ino
26 lines (24 loc) · 806 Bytes
/
ntp.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// AIQ Station
// Temperature, Humidity and Pressure
// with Lolin ESP8266
//
// Written by Michele <o-zone@zerozone.it> Pinassi
// Released under GPLv3 - No any warranty
#include <NtpClientLib.h>
// ************************************
// processSyncEvent()
//
// manage NTP sync events and warn in case of error
// ************************************
void processSyncEvent(NTPSyncEvent_t ntpEvent) {
DEBUG_PRINT("[DEBUG] processSyncEvent() ");
if (ntpEvent) {
DEBUG_PRINT("[NTP] Time Sync error: ");
if (ntpEvent == noResponse)
DEBUG_PRINT("[NTP] NTP server not reachable");
else if (ntpEvent == invalidAddress)
DEBUG_PRINT("[NTP] Invalid NTP server address");
} else {
DEBUG_PRINT("[NTP] Got NTP time: "+String(NTP.getTimeDateString(NTP.getLastNTPSync ())));
}
}