diff --git a/esphome/components/esp32/core.cpp b/esphome/components/esp32/core.cpp index 501dd7d2eaf..1bb34295cd5 100644 --- a/esphome/components/esp32/core.cpp +++ b/esphome/components/esp32/core.cpp @@ -23,7 +23,7 @@ namespace esphome { void HOT yield() { vPortYield(); } uint32_t IRAM_ATTR HOT millis() { return (uint32_t) (esp_timer_get_time() / 1000ULL); } -uint64_t HOT millis_64() { return esp_timer_get_time() / 1000; } +uint64_t HOT millis_64() { return esp_timer_get_time() / 1000ULL; } void HOT delay(uint32_t ms) { vTaskDelay(ms / portTICK_PERIOD_MS); } uint32_t IRAM_ATTR HOT micros() { return (uint32_t) esp_timer_get_time(); } void IRAM_ATTR HOT delayMicroseconds(uint32_t us) { delay_microseconds_safe(us); } diff --git a/esphome/core/scheduler.h b/esphome/core/scheduler.h index c61bd40f7c1..757f60c2ce3 100644 --- a/esphome/core/scheduler.h +++ b/esphome/core/scheduler.h @@ -120,10 +120,10 @@ class Scheduler { /// Get 64-bit millisecond timestamp (handles 32-bit millis() rollover) uint64_t millis_64() { return esphome::millis_64(); } - // Calculate when the next scheduled item should run - // @param now On ESP32, unused (native 64-bit); on other platforms, extended to 64-bit via rollover tracking - // Returns the time in milliseconds until the next scheduled item, or nullopt if no items - // This method performs cleanup of removed items before checking the schedule + // Calculate when the next scheduled item should run. + // @param now On ESP32, unused for 64-bit extension (native); on other platforms, extended to 64-bit via rollover. + // Returns the time in milliseconds until the next scheduled item, or nullopt if no items. + // This method performs cleanup of removed items before checking the schedule. // IMPORTANT: This method should only be called from the main thread (loop task). optional next_schedule_in(uint32_t now);