22#ifdef ESPHOME_THREAD_SINGLE
25 static uint16_t millis_major_;
27 static inline uint64_t ESPHOME_ALWAYS_INLINE compute(
uint32_t now) {
29 static constexpr uint32_t HALF_MAX_UINT32 = std::numeric_limits<uint32_t>::max() / 2;
33 uint16_t major = millis_major_;
37 if (now < last && (last - now) > HALF_MAX_UINT32) {
41 }
else if (now > last) {
47 return now + (
static_cast<uint64_t
>(major) << 32);
50 static uint64_t compute(
uint32_t now);