FastLED 3.9.15
Loading...
Searching...
No Matches

◆ applyExact()

void fl::TimeWarp::applyExact ( uint32_t timeNow)
private

Definition at line 63 of file time.cpp.

63 {
64 uint32_t elapsedRealTime = timeNow - mLastRealTime;
65 mLastRealTime = timeNow;
66 int32_t diff = static_cast<int32_t>(elapsedRealTime * mTimeScale);
67 if (diff == 0) {
68 return;
69 }
70 if (diff >= 0) {
71 mRelativeTime += diff;
72 return;
73 }
74
75 // diff < 0
76 uint32_t abs_diff = -diff;
77 if (abs_diff > mRelativeTime) {
78 // Protection against rollover.
79 mRelativeTime = 0;
80 mLastRealTime = timeNow;
81 return;
82 }
83 mLastRealTime = timeNow;
84 mRelativeTime -= abs_diff;
85}
float mTimeScale
Definition time.h:50
uint32_t mLastRealTime
Definition time.h:47
uint32_t mRelativeTime
Definition time.h:49

References mLastRealTime, mRelativeTime, and mTimeScale.

Referenced by update().

+ Here is the caller graph for this function: