fix
This commit is contained in:
parent
b3b1908480
commit
12626941ce
@ -134,7 +134,6 @@ bool wizDnsQuery(char *name, uint8_t *ip) {
|
||||
|
||||
|
||||
uint64_t wizSntpQuery() {
|
||||
bool success = false;
|
||||
uint64_t seconds = 0;
|
||||
|
||||
if (networkAvailable) {
|
||||
@ -143,20 +142,17 @@ uint64_t wizSntpQuery() {
|
||||
uint8_t ntpServer[4];
|
||||
if (wizDnsQuery(config->ntpServer, ntpServer)) {
|
||||
SNTP_init(SNTP_SOCK, ntpServer, 0, sntpBuffer);
|
||||
bool updated = false;
|
||||
for (uint8_t i = 0; i < 16; i++) {
|
||||
datetime curTime;
|
||||
int8_t res = SNTP_run(&curTime);
|
||||
if (res == 1) {
|
||||
seconds = curTime.seconds - UNIX_NTP_EPOCH_DIFF;
|
||||
updated = true;
|
||||
success = true;
|
||||
coloredMsg(LOG_BLUE, "wizsq, curTime: %lu", seconds);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! updated) {
|
||||
if (seconds == 0) {
|
||||
coloredMsg(LOG_BLUE, "wizsq, time update failed");
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user