diff --git a/esphome/components/esp32/core.cpp b/esphome/components/esp32/core.cpp index b9ae871abf..501dd7d2ea 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 static_cast(esp_timer_get_time()) / 1000ULL; } +uint64_t HOT millis_64() { return esp_timer_get_time() / 1000; } 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 fa95484e7f..c61bd40f7c 100644 --- a/esphome/core/scheduler.h +++ b/esphome/core/scheduler.h @@ -121,7 +121,7 @@ class Scheduler { uint64_t millis_64() { return esphome::millis_64(); } // Calculate when the next scheduled item should run - // @param now Unused, kept for API compatibility + // @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 // IMPORTANT: This method should only be called from the main thread (loop task). @@ -299,7 +299,7 @@ class Scheduler { // On non-ESP32 platforms, millis_64() HAL function delegates to this method // which tracks 32-bit millis() rollover using millis_major_ and last_millis_. // On ESP32, millis_64() uses esp_timer_get_time() directly. - friend uint64_t millis_64(); + friend uint64_t ::esphome::millis_64(); uint64_t millis_64_impl_(uint32_t now); #endif // Cleanup logically deleted items from the scheduler