[core] Document clock divergence between millis() and millis_64_from_()

On ESP32, millis() uses xTaskGetTickCount (tick clock) but
millis_64_from_() discards the 32-bit value and calls millis_64()
(esp_timer clock). Safe because scheduling only compares millis_64
against millis_64. On ESP8266, both use the same accumulator clock.
This commit is contained in:
J. Nick Koston
2026-04-12 09:49:28 -10:00
parent 0249c30cbf
commit e5a0246c80
+6 -2
View File
@@ -284,8 +284,12 @@ class Scheduler {
bool cancel_retry_(Component *component, NameType name_type, const char *static_name, uint32_t hash_or_id);
// Extend a 32-bit millis() value to 64-bit. Use when the caller already has a fresh now.
// On platforms with native 64-bit time, ignores now and uses millis_64() directly.
// On other platforms, extends now to 64-bit using rollover tracking.
// On platforms with native 64-bit time (ESP32), ignores now and uses millis_64() directly.
// This means the Scheduler uses the esp_timer clock (via millis_64()) for all scheduling,
// even though the caller's 32-bit now came from xTaskGetTickCount (via millis()). Safe
// because scheduling only compares millis_64 against millis_64 — never against millis().
// On other platforms (ESP8266), extends now to 64-bit using rollover tracking, so both
// millis() and scheduling use the same clock.
uint64_t millis_64_from_(uint32_t now) {
#ifdef USE_NATIVE_64BIT_TIME
(void) now;