MCPcopy Create free account
hub / github.com/FastLED/FastLED / millis64

Function millis64

src/fl/stl/chrono.cpp.hpp:108–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108fl::u64 millis64() {
109 Millis64State& state = get_millis64_state();
110 fl::u32 current_millis = fl::millis();
111 fl::unique_lock<fl::mutex> lock(state.mutex);
112
113 if (!state.initialized) {
114 // First call, set initial value
115 state.accumulated = current_millis;
116 state.last_millis = current_millis;
117 state.initialized = true;
118 return state.accumulated;
119 }
120
121 // Detect wraparound: current < last means 32-bit counter wrapped
122 // Delta calculation handles wraparound correctly via unsigned arithmetic
123 fl::u32 delta = current_millis - state.last_millis;
124
125 // Accumulate the delta into 64-bit counter
126 state.accumulated += delta;
127
128 // Update last value for next call
129 state.last_millis = current_millis;
130
131 return state.accumulated;
132}
133
134} // namespace fl

Callers 2

chrono.hFile · 0.85
FL_TEST_FILEFunction · 0.85

Calls 1

millisFunction · 0.70

Tested by

no test coverage detected