Skip to content

Commit

Permalink
Merge pull request #7 from jeremypoulter/time_get_set_fix
Browse files Browse the repository at this point in the history
Fixing getting the time from the EVSE
  • Loading branch information
jeremypoulter authored Mar 18, 2023
2 parents e770646 + 0f9b812 commit 8e33a71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/openevse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void OpenEVSEClass::getTime(std::function<void(int ret, time_t time)> callback)
memset(&tm, 0, sizeof(tm));

tm.tm_year = 100+year;
tm.tm_mon = month;
tm.tm_mon = month - 1;
tm.tm_mday = day;
tm.tm_hour = hour;
tm.tm_min = minute;
Expand All @@ -177,7 +177,7 @@ void OpenEVSEClass::setTime(time_t time, std::function<void(int ret)> callback)
// S1 yr mo day hr min sec - set clock (RTC) yr=2-digit year

struct tm tm;
gmtime_r(&time, &tm);
localtime_r(&time, &tm);

setTime(tm, callback);
}
Expand Down

0 comments on commit 8e33a71

Please sign in to comment.