Files
allwpilib/wpilibc/src/main/native/cpp/Timer.cpp
Kevin Jaget fa809b2c4b [wpilibc] Clean up include files (#2708)
Based on run of include-what-you-use.org to identify unused include files in various .h and .cpp files.

The changes mostly fall into 3 categories:
- Actually unused includes - copy-paste errors, not removing includes after cleaning up code, etc
- A too-broad include used where a more specific (and hopefully smaller) header will do
- Interface .h files including headers only needed by the .cpp implementation - moving from .h to .cpp
  will mean that code which uses the .h doesn't pay the price of processing the header file they don't need
2020-10-03 09:21:03 -07:00

43 lines
1.2 KiB
C++

/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#include "frc/Timer.h"
#include <units/time.h>
namespace frc {
void Wait(double seconds) { frc2::Wait(units::second_t(seconds)); }
double GetTime() { return frc2::GetTime().to<double>(); }
} // namespace frc
using namespace frc;
Timer::Timer() { Reset(); }
double Timer::Get() const { return m_timer.Get().to<double>(); }
void Timer::Reset() { m_timer.Reset(); }
void Timer::Start() { m_timer.Start(); }
void Timer::Stop() { m_timer.Stop(); }
bool Timer::HasPeriodPassed(double period) {
return m_timer.HasPeriodPassed(units::second_t(period));
}
double Timer::GetFPGATimestamp() {
return frc2::Timer::GetFPGATimestamp().to<double>();
}
double Timer::GetMatchTime() {
return frc2::Timer::GetMatchTime().to<double>();
}