1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-08 12:53:45 +01:00

[time] Fix clang-tidy sign comparison errors (#11080)

This commit is contained in:
J. Nick Koston
2025-10-06 14:34:40 -05:00
committed by GitHub
parent f670d775ac
commit 24dcc1843e

View File

@@ -77,7 +77,7 @@ bool ESPTime::strptime(const std::string &time_to_parse, ESPTime &esp_time) {
&hour, // NOLINT &hour, // NOLINT
&minute, // NOLINT &minute, // NOLINT
&second, &num) == 6 && // NOLINT &second, &num) == 6 && // NOLINT
num == time_to_parse.size()) { num == static_cast<int>(time_to_parse.size())) {
esp_time.year = year; esp_time.year = year;
esp_time.month = month; esp_time.month = month;
esp_time.day_of_month = day; esp_time.day_of_month = day;
@@ -87,7 +87,7 @@ bool ESPTime::strptime(const std::string &time_to_parse, ESPTime &esp_time) {
} else if (sscanf(time_to_parse.c_str(), "%04hu-%02hhu-%02hhu %02hhu:%02hhu %n", &year, &month, &day, // NOLINT } else if (sscanf(time_to_parse.c_str(), "%04hu-%02hhu-%02hhu %02hhu:%02hhu %n", &year, &month, &day, // NOLINT
&hour, // NOLINT &hour, // NOLINT
&minute, &num) == 5 && // NOLINT &minute, &num) == 5 && // NOLINT
num == time_to_parse.size()) { num == static_cast<int>(time_to_parse.size())) {
esp_time.year = year; esp_time.year = year;
esp_time.month = month; esp_time.month = month;
esp_time.day_of_month = day; esp_time.day_of_month = day;
@@ -95,17 +95,17 @@ bool ESPTime::strptime(const std::string &time_to_parse, ESPTime &esp_time) {
esp_time.minute = minute; esp_time.minute = minute;
esp_time.second = 0; esp_time.second = 0;
} else if (sscanf(time_to_parse.c_str(), "%02hhu:%02hhu:%02hhu %n", &hour, &minute, &second, &num) == 3 && // NOLINT } else if (sscanf(time_to_parse.c_str(), "%02hhu:%02hhu:%02hhu %n", &hour, &minute, &second, &num) == 3 && // NOLINT
num == time_to_parse.size()) { num == static_cast<int>(time_to_parse.size())) {
esp_time.hour = hour; esp_time.hour = hour;
esp_time.minute = minute; esp_time.minute = minute;
esp_time.second = second; esp_time.second = second;
} else if (sscanf(time_to_parse.c_str(), "%02hhu:%02hhu %n", &hour, &minute, &num) == 2 && // NOLINT } else if (sscanf(time_to_parse.c_str(), "%02hhu:%02hhu %n", &hour, &minute, &num) == 2 && // NOLINT
num == time_to_parse.size()) { num == static_cast<int>(time_to_parse.size())) {
esp_time.hour = hour; esp_time.hour = hour;
esp_time.minute = minute; esp_time.minute = minute;
esp_time.second = 0; esp_time.second = 0;
} else if (sscanf(time_to_parse.c_str(), "%04hu-%02hhu-%02hhu %n", &year, &month, &day, &num) == 3 && // NOLINT } else if (sscanf(time_to_parse.c_str(), "%04hu-%02hhu-%02hhu %n", &year, &month, &day, &num) == 3 && // NOLINT
num == time_to_parse.size()) { num == static_cast<int>(time_to_parse.size())) {
esp_time.year = year; esp_time.year = year;
esp_time.month = month; esp_time.month = month;
esp_time.day_of_month = day; esp_time.day_of_month = day;