MCPcopy Create free account
hub / github.com/LemLib/LemLib / getTimeLeft

Method getTimeLeft

src/lemlib/timer.cpp:18–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18uint32_t Timer::getTimeLeft() {
19 const uint32_t time = pros::millis(); // get time from RTOS
20 if (!paused) timeWaited += time - lastTime; // don't update if paused
21 lastTime = time; // update last time
22 const int delta = period - timeWaited; // calculate how much time is left
23 return (delta > 0) ? delta : 0; // return 0 if timer is done
24}
25
26uint32_t Timer::getTimePassed() {
27 const uint32_t time = pros::millis(); // get time from RTOS

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected