cleancode changes from cppcheck and cpplint

This commit is contained in:
Paul
2019-10-09 13:55:50 +02:00
parent fb1527eee1
commit d51e61fd1f
6 changed files with 18 additions and 42 deletions

View File

@@ -73,7 +73,6 @@ void breakTime(time_t timeInput, tmElements_t & tm) {
days -= LEAP_YEAR(year) ? 366 : 365;
time -= days; // now it is days in this year, starting at 0
days = 0;
month = 0;
monthLength = 0;
for (month = 0; month < 12; month++) {
@@ -104,36 +103,21 @@ void refreshCache(time_t t) {
}
}
int day(time_t t) { // the day for the given time (0-6)
refreshCache(t);
return tm.Day;
}
int month(time_t t) { // the month for the given time
refreshCache(t);
return tm.Month;
}
int second(time_t t) { // the second for the given time
uint8_t to_second(time_t t) { // the second for the given time
refreshCache(t);
return tm.Second;
}
int minute(time_t t) { // the minute for the given time
uint8_t to_minute(time_t t) { // the minute for the given time
refreshCache(t);
return tm.Minute;
}
int hour(time_t t) { // the hour for the given time
uint8_t to_hour(time_t t) { // the hour for the given time
refreshCache(t);
return tm.Hour;
}
int year(time_t t) { // the year for the given time
refreshCache(t);
return tmYearToCalendar(tm.Year);
}
void setTime(time_t t) {
sysTime = (uint32_t)t;
nextSyncTime = (uint32_t)t + syncInterval;