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

Function get_time_since_epoch

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

Source from the content-addressed store, hash-verified

61double gStartTime = emscripten_get_now(); // Use emscripten_get_now() for consistency
62
63double get_time_since_epoch() {
64 double now = emscripten_get_now();
65 double elapsed = now - gStartTime;
66
67 // Debug output to track the timing issue
68 //FL_WARN("gStartTime: " << gStartTime);
69 //FL_WARN("now: " << now);
70 //FL_WARN("elapsed: " << elapsed);
71
72 // Ensure we return a reasonable positive elapsed time
73 if (elapsed < 0 || elapsed == 0xffffffff) {
74 FL_WARN("WARNING: Negative elapsed time detected, resetting start time");
75 gStartTime = now;
76 elapsed = 0;
77 }
78
79 return elapsed;
80}
81} // namespace
82
83// Needed or the wasm compiler will strip them out.

Callers 2

millisFunction · 0.85
microsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected