[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

@@ -123,7 +123,7 @@ public class Timer {
*/
public boolean hasElapsed(double seconds) {
synchronized (m_lock) {
return get() > seconds;
return get() >= seconds;
}
}
@@ -151,7 +151,7 @@ public class Timer {
*/
public boolean advanceIfElapsed(double seconds) {
synchronized (m_lock) {
if (get() > seconds) {
if (get() >= seconds) {
// Advance the start time by the period.
// Don't set it to the current time... we want to avoid drift.
m_startTime += seconds * 1000;