J. Nick Koston 6d1d924ff9 [core] time_64 NO_ATOMICS: atomic re-reads + reload major under lock
Two fixes Copilot flagged on #15947:

1. Use __atomic_load_n to re-read last_millis under the lock, not a
   plain read. The forward-progression branch (else if) writes
   last_millis with __atomic_store_n without holding lock, so the
   under-lock plain read would race with it and be UB in the C++
   memory model.

2. Reload major from millis_major after acquiring the lock. The
   unlocked load at the top of the function can be stale by the time
   we get the lock: another thread may have completed a rollover
   between the unlocked load and the lock acquisition, leaving our
   local major behind by one. Without reload the function could
   return a 64-bit timestamp that jumps backwards by ~2^32 ms (~49.7
   days). The MULTI_ATOMICS branch already handles this via its retry
   loop; NO_ATOMICS just reloads under the lock.
2026-04-23 06:28:21 -05:00
2023-06-12 17:00:34 +12:00
2022-09-06 15:48:01 +12:00
2025-12-21 09:26:03 -05:00
2024-03-28 10:20:51 +13:00
2025-07-17 22:40:28 +12:00
2025-12-08 14:37:45 -05:00
2026-04-09 11:28:48 +12:00
2025-07-17 22:40:28 +12:00
S
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme Multiple Licenses 546 MiB
Languages
C++ 60.1%
Python 39.3%
C 0.3%
JavaScript 0.2%