Skip to content

Commit 410a1b4

Browse files
committed
Call API getTime first and use NTP UDP as a fallback
1 parent 85e760e commit 410a1b4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/GSMConnectionManager.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ GSMConnectionManager::GSMConnectionManager(const char *pin, const char *apn, con
6767
}
6868

6969
unsigned long GSMConnectionManager::getTime() {
70-
unsigned long time = ConnectionManager::getTime() {
70+
unsigned long time = gsmAccess.getTime() {
7171
if (!NTPUtils::isTimeValid(time)) {
72-
debugMessage("Bogus UDP time from, fallback to Network method", 0);
73-
time = gsmAccess.getTime();
72+
debugMessage("Bogus NTP time from API, fallback to UDP method", 0);
73+
time = ConnectionManager::getTime();
7474
}
7575
return time;
7676
}

src/WiFiConnectionManager.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ WiFiConnectionManager::WiFiConnectionManager(const char *ssid, const char *pass)
6363
}
6464

6565
unsigned long WiFiConnectionManager::getTime() {
66-
unsigned long time = ConnectionManager::getTime();
66+
unsigned long time = WiFi.getTime();
6767
if (!NTPUtils::isTimeValid(time)) {
68-
debugMessage("Bogus UDP time from, fallback to Network method", 0);
69-
time = WiFi.getTime();
68+
debugMessage("Bogus NTP time from API, fallback to UDP method", 0);
69+
time = ConnectionManager::getTime();
7070
}
7171
return time;
7272
}

0 commit comments

Comments
 (0)