[wpilib] Add Timer tests (#3595)

This commit is contained in:
Tyler Veness
2021-09-22 13:26:58 -07:00
committed by GitHub
parent 59c89428e5
commit 118a27be2f
4 changed files with 251 additions and 4 deletions

View File

@@ -63,7 +63,7 @@ void Timer::Stop() {
}
bool Timer::HasElapsed(units::second_t period) const {
return Get() > period;
return Get() >= period;
}
bool Timer::HasPeriodPassed(units::second_t period) {
@@ -71,7 +71,7 @@ bool Timer::HasPeriodPassed(units::second_t period) {
}
bool Timer::AdvanceIfElapsed(units::second_t period) {
if (Get() > period) {
if (Get() >= period) {
// Advance the start time by the period.
m_startTime += period;
// Don't set it to the current time... we want to avoid drift.