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

Function micros

src/platforms/wasm/timer.cpp.hpp:103–115  ·  view source on GitHub ↗

Replacement for 'micros' in WebAssembly context

Source from the content-addressed store, hash-verified

101
102// Replacement for 'micros' in WebAssembly context
103EMSCRIPTEN_KEEPALIVE fl::u32 micros() {
104 double elapsed_ms = get_time_since_epoch();
105 double elapsed_micros = elapsed_ms * 1000.0;
106
107 // Handle potential overflow - Arduino micros() wraps around every ~71.6 minutes
108 // This matches Arduino behavior where micros() overflows back to 0
109 if (elapsed_micros >= fl::numeric_limits<fl::u32>::max()) {
110 elapsed_micros = fmod(elapsed_micros, fl::numeric_limits<fl::u32>::max());
111 }
112
113 fl::u32 result = fl::u32(elapsed_micros);
114 return result;
115}
116
117// Replacement for 'yield' in WebAssembly context
118EMSCRIPTEN_KEEPALIVE void yield() {

Callers 5

getCurrentTimestampMethod · 0.50
transmitMethod · 0.50
queueTransactionMethod · 0.50
getMicrosecondsMethod · 0.50
time_stub.cpp.hppFile · 0.50

Calls 4

get_time_since_epochFunction · 0.85
maxFunction · 0.85
fmodFunction · 0.85
u32Enum · 0.50

Tested by

no test coverage detected