1
0
mirror of https://github.com/esphome/esphome.git synced 2024-10-06 19:00:59 +01:00

remove unused static declarations (#4993)

This commit is contained in:
Samuel Sieb 2023-06-22 18:03:31 -07:00 committed by Jesse Hills
parent 746f72a279
commit 595ac84779
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
2 changed files with 10 additions and 14 deletions

View File

@ -2,6 +2,16 @@
namespace esphome {
static bool is_leap_year(uint32_t year) { return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0); }
static uint8_t days_in_month(uint8_t month, uint16_t year) {
static const uint8_t DAYS_IN_MONTH[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
uint8_t days = DAYS_IN_MONTH[month];
if (month == 2 && is_leap_year(year))
return 29;
return days;
}
size_t ESPTime::strftime(char *buffer, size_t buffer_len, const char *format) {
struct tm c_tm = this->to_c_tm();
return ::strftime(buffer, buffer_len, format, &c_tm);
@ -158,14 +168,4 @@ template<typename T> bool increment_time_value(T &current, uint16_t begin, uint1
return false;
}
static bool is_leap_year(uint32_t year) { return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0); }
static uint8_t days_in_month(uint8_t month, uint16_t year) {
static const uint8_t DAYS_IN_MONTH[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
uint8_t days = DAYS_IN_MONTH[month];
if (month == 2 && is_leap_year(year))
return 29;
return days;
}
} // namespace esphome

View File

@ -8,10 +8,6 @@ namespace esphome {
template<typename T> bool increment_time_value(T &current, uint16_t begin, uint16_t end);
static bool is_leap_year(uint32_t year);
static uint8_t days_in_month(uint8_t month, uint16_t year);
/// A more user-friendly version of struct tm from time.h
struct ESPTime {
/** seconds after the minute [0-60]