[wpilib] Remove Timer lock in wpilibj and update docs (#3602)

Timer reports a negative duration if the sim timing is restarted. This
can be worked around by calling Reset(). Other options included:

1. Have RestartTiming() call Timer::Reset() on a list of instantiated
   Timers.
2. Have Timer::Get() reset the timer if it notices time went backwards.
   This requires dropping const qualification though, which is a
   breaking change that only fixes a minor edge case.

Closes #2732.
This commit is contained in:
Tyler Veness
2021-09-24 16:01:13 -07:00
committed by GitHub
parent 3b8d3bbcbf
commit b65fce86bf
2 changed files with 32 additions and 37 deletions

View File

@@ -29,7 +29,10 @@ void Wait(units::second_t seconds);
units::second_t GetTime();
/**
* A wrapper for the frc::Timer class that returns unit-typed values.
* A timer class.
*
* Note that if the user calls frc::sim::RestartTiming(), they should also reset
* the timer so Get() won't return a negative duration.
*/
class Timer {
public: