Skip to content

Commit

Permalink
Make sure date time entered in captive portal is valid before setting…
Browse files Browse the repository at this point in the history
… RTC clock.
  • Loading branch information
gb0101010101 committed Apr 2, 2019
1 parent fb02d39 commit 418b086
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions WiFiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,12 @@ void WiFiManager::handleWifiSave() {
// Set clock if requested.
if ((_time.length() == 8) && (_date.length() == 11)) {
RtcDateTime compiled = RtcDateTime(_date.c_str(), _time.c_str());
DEBUG_WM("Updating DateTime in RTC");
Rtc.SetDateTime(compiled);
if (compiled.IsValid()) {
DEBUG_WM("Updating DateTime in RTC");
Rtc.SetDateTime(compiled);
} else {
DEBUG_WM("DateTime entered not valid. Not updating RTC.");
}
} else {
DEBUG_WM("Not updating DateTime in RTC");
}
Expand Down

0 comments on commit 418b086

Please sign in to comment.