mirror of
https://github.com/esphome/esphome.git
synced 2025-07-29 06:36:45 +00:00
Mark ESPTime comparison operators as const (#9335)
This commit is contained in:
parent
4e9e48e2e7
commit
b0f8922056
@ -226,11 +226,11 @@ int32_t ESPTime::timezone_offset() {
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ESPTime::operator<(ESPTime other) { return this->timestamp < other.timestamp; }
|
bool ESPTime::operator<(const ESPTime &other) const { return this->timestamp < other.timestamp; }
|
||||||
bool ESPTime::operator<=(ESPTime other) { return this->timestamp <= other.timestamp; }
|
bool ESPTime::operator<=(const ESPTime &other) const { return this->timestamp <= other.timestamp; }
|
||||||
bool ESPTime::operator==(ESPTime other) { return this->timestamp == other.timestamp; }
|
bool ESPTime::operator==(const ESPTime &other) const { return this->timestamp == other.timestamp; }
|
||||||
bool ESPTime::operator>=(ESPTime other) { return this->timestamp >= other.timestamp; }
|
bool ESPTime::operator>=(const ESPTime &other) const { return this->timestamp >= other.timestamp; }
|
||||||
bool ESPTime::operator>(ESPTime other) { return this->timestamp > other.timestamp; }
|
bool ESPTime::operator>(const ESPTime &other) const { return this->timestamp > other.timestamp; }
|
||||||
|
|
||||||
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) {
|
||||||
current++;
|
current++;
|
||||||
|
@ -109,10 +109,10 @@ struct ESPTime {
|
|||||||
void increment_second();
|
void increment_second();
|
||||||
/// Increment this clock instance by one day.
|
/// Increment this clock instance by one day.
|
||||||
void increment_day();
|
void increment_day();
|
||||||
bool operator<(ESPTime other);
|
bool operator<(const ESPTime &other) const;
|
||||||
bool operator<=(ESPTime other);
|
bool operator<=(const ESPTime &other) const;
|
||||||
bool operator==(ESPTime other);
|
bool operator==(const ESPTime &other) const;
|
||||||
bool operator>=(ESPTime other);
|
bool operator>=(const ESPTime &other) const;
|
||||||
bool operator>(ESPTime other);
|
bool operator>(const ESPTime &other) const;
|
||||||
};
|
};
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
Loading…
x
Reference in New Issue
Block a user