From 9162c34517145af51d8561c7fedd613524bf0f56 Mon Sep 17 00:00:00 2001 From: clydebarrow <2366188+clydebarrow@users.noreply.github.com> Date: Sat, 18 Jan 2025 04:48:06 +1100 Subject: [PATCH] Remove unnecessary code. --- esphome/components/uptime/text_sensor/uptime_text_sensor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/esphome/components/uptime/text_sensor/uptime_text_sensor.cpp b/esphome/components/uptime/text_sensor/uptime_text_sensor.cpp index e08a33df62..e0b388dd30 100644 --- a/esphome/components/uptime/text_sensor/uptime_text_sensor.cpp +++ b/esphome/components/uptime/text_sensor/uptime_text_sensor.cpp @@ -21,8 +21,7 @@ void UptimeTextSensor::update() { // 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. const uint32_t delta = (now - this->last_ms_) / 1000; - // set last_ms_ to the last second boundary - this->last_ms_ = now - (now % 1000); + this->last_ms_ = now; this->uptime_ += delta; auto uptime = this->uptime_; unsigned interval = this->get_update_interval() / 1000;