Skip to content

Commit b934478

Browse files
committed
Make getTime return 0 on failure (instead of -1)
1 parent f28d84b commit b934478

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/WiFi.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,8 @@ uint32_t WiFiClass::getTime()
916916
m2m_wifi_handle_events(NULL);
917917
}
918918

919+
time_t t = -1;
920+
919921
if (_resolve == 0) {
920922
struct tm tm;
921923

@@ -927,12 +929,16 @@ uint32_t WiFiClass::getTime()
927929
tm.tm_sec = systemTime.u8Second;
928930
tm.tm_isdst = -1;
929931

930-
_resolve = mktime(&tm);
931-
} else {
932-
_resolve = (uint32_t)-1;
932+
t = mktime(&tm);
933933
}
934934

935-
return _resolve;
935+
_resolve = 0;
936+
937+
if (t == -1) {
938+
t = 0;
939+
}
940+
941+
return t;
936942
}
937943

938944
WiFiClass WiFi;

0 commit comments

Comments
 (0)