mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 08:55:22 +01:00
remove unused static declarations (#4993)
This commit is contained in:
parent
ec3d5fc427
commit
fc0e1a3cb9
2 changed files with 10 additions and 14 deletions
|
@ -2,6 +2,16 @@
|
||||||
|
|
||||||
namespace esphome {
|
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) {
|
size_t ESPTime::strftime(char *buffer, size_t buffer_len, const char *format) {
|
||||||
struct tm c_tm = this->to_c_tm();
|
struct tm c_tm = this->to_c_tm();
|
||||||
return ::strftime(buffer, buffer_len, format, &c_tm);
|
return ::strftime(buffer, buffer_len, format, &c_tm);
|
||||||
|
@ -158,14 +168,4 @@ template<typename T> bool increment_time_value(T ¤t, uint16_t begin, uint1
|
||||||
return false;
|
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
|
} // namespace esphome
|
||||||
|
|
|
@ -8,10 +8,6 @@ namespace esphome {
|
||||||
|
|
||||||
template<typename T> bool increment_time_value(T ¤t, uint16_t begin, uint16_t end);
|
template<typename T> bool increment_time_value(T ¤t, 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
|
/// A more user-friendly version of struct tm from time.h
|
||||||
struct ESPTime {
|
struct ESPTime {
|
||||||
/** seconds after the minute [0-60]
|
/** seconds after the minute [0-60]
|
||||||
|
|
Loading…
Reference in a new issue