mirror of
https://github.com/esphome/esphome.git
synced 2025-03-01 08:18:16 +00:00
Remove unnecessary code.
This commit is contained in:
parent
180f665df3
commit
9162c34517
@ -21,8 +21,7 @@ void UptimeTextSensor::update() {
|
|||||||
// get whole seconds since last update. Note that even if the millis count has overflowed between updates,
|
// get whole seconds since last update. Note that even if the millis count has overflowed between updates,
|
||||||
// the difference will still be correct due to the way twos-complement arithmetic works.
|
// the difference will still be correct due to the way twos-complement arithmetic works.
|
||||||
const uint32_t delta = (now - this->last_ms_) / 1000;
|
const uint32_t delta = (now - this->last_ms_) / 1000;
|
||||||
// set last_ms_ to the last second boundary
|
this->last_ms_ = now;
|
||||||
this->last_ms_ = now - (now % 1000);
|
|
||||||
this->uptime_ += delta;
|
this->uptime_ += delta;
|
||||||
auto uptime = this->uptime_;
|
auto uptime = this->uptime_;
|
||||||
unsigned interval = this->get_update_interval() / 1000;
|
unsigned interval = this->get_update_interval() / 1000;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user