mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 17:18:40 +00:00
[core] Fix clang-tidy naming in time_64.h SINGLE branch
The static class members in Millis64Impl's ESPHOME_THREAD_SINGLE branch kept the trailing-underscore convention used for instance members, but the project's clang-tidy config (readability-identifier-naming. ClassMemberCase = lower_case) wants static class members without the suffix. This violation was latent because defines.h previously hardcoded MULTI_ATOMICS, so the SINGLE branch was never analyzed; now that defines.h picks the model per platform, the ESP8266 tidy env analyzes this branch. Drop the trailing _ from last_millis / millis_major; their types and initial values are unchanged.
This commit is contained in:
@@ -22,8 +22,8 @@ static const char *const TAG = "time_64";
|
||||
|
||||
#ifdef ESPHOME_THREAD_SINGLE
|
||||
// Storage for Millis64Impl inline compute() — defined here so all TUs share one copy.
|
||||
uint32_t Millis64Impl::last_millis_{0};
|
||||
uint16_t Millis64Impl::millis_major_{0};
|
||||
uint32_t Millis64Impl::last_millis{0};
|
||||
uint16_t Millis64Impl::millis_major{0};
|
||||
#else
|
||||
|
||||
uint64_t Millis64Impl::compute(uint32_t now) {
|
||||
|
||||
@@ -21,8 +21,8 @@ class Millis64Impl {
|
||||
|
||||
#ifdef ESPHOME_THREAD_SINGLE
|
||||
// Storage defined in time_64.cpp — declared here so the inline body can access them.
|
||||
static uint32_t last_millis_;
|
||||
static uint16_t millis_major_;
|
||||
static uint32_t last_millis;
|
||||
static uint16_t millis_major;
|
||||
|
||||
static inline uint64_t ESPHOME_ALWAYS_INLINE compute(uint32_t now) {
|
||||
// Half the 32-bit range - used to detect rollovers vs normal time progression
|
||||
@@ -30,17 +30,17 @@ class Millis64Impl {
|
||||
|
||||
// Single-core platforms have no concurrency, so this is a simple implementation
|
||||
// that just tracks 32-bit rollover (every 49.7 days) without any locking or atomics.
|
||||
uint16_t major = millis_major_;
|
||||
uint32_t last = last_millis_;
|
||||
uint16_t major = millis_major;
|
||||
uint32_t last = last_millis;
|
||||
|
||||
// Check for rollover
|
||||
if (now < last && (last - now) > HALF_MAX_UINT32) {
|
||||
millis_major_++;
|
||||
millis_major++;
|
||||
major++;
|
||||
last_millis_ = now;
|
||||
last_millis = now;
|
||||
} else if (now > last) {
|
||||
// Only update if time moved forward
|
||||
last_millis_ = now;
|
||||
last_millis = now;
|
||||
}
|
||||
|
||||
// Combine major (high 32 bits) and now (low 32 bits) into 64-bit time
|
||||
|
||||
Reference in New Issue
Block a user