mirror of
https://github.com/esphome/esphome.git
synced 2026-10-03 01:35:59 +00:00
[core] Use constexpr for compile-time constants (#14071)
This commit is contained in:
@@ -728,7 +728,7 @@ uint64_t Scheduler::millis_64_(uint32_t now) {
|
||||
|
||||
// Define a safe window around the rollover point (10 seconds)
|
||||
// This covers any reasonable scheduler delays or thread preemption
|
||||
static const uint32_t ROLLOVER_WINDOW = 10000; // 10 seconds in milliseconds
|
||||
static constexpr uint32_t ROLLOVER_WINDOW = 10000; // 10 seconds in milliseconds
|
||||
|
||||
// Check if we're near the rollover boundary (close to std::numeric_limits<uint32_t>::max() or just past 0)
|
||||
bool near_rollover = (last > (std::numeric_limits<uint32_t>::max() - ROLLOVER_WINDOW)) || (now < ROLLOVER_WINDOW);
|
||||
|
||||
Reference in New Issue
Block a user