Unify WPI_Now and HAL_GetFPGATime. (#743)

Depends on wpilibsuite/wpiutil#56.
This commit is contained in:
Peter Johnson
2017-11-19 12:33:36 -08:00
committed by GitHub
parent 303c259b89
commit 7f46b50b21
3 changed files with 19 additions and 8 deletions

View File

@@ -19,19 +19,15 @@ static std::atomic<bool> programStarted{false};
static std::atomic<uint64_t> programStartTime{0};
namespace hal {
void RestartTiming() { programStartTime = wpi::Now() / 10; }
void RestartTiming() { programStartTime = wpi::Now(); }
int64_t GetFPGATime() {
auto now = wpi::Now() / 10;
auto now = wpi::Now();
auto currentTime = now - programStartTime;
return currentTime;
}
double GetFPGATimestamp() {
auto now = wpi::Now() / 10;
auto currentTime = now - programStartTime;
return currentTime * 1.0e-6;
}
double GetFPGATimestamp() { return GetFPGATime() * 1.0e-6; }
void SetProgramStarted() { programStarted = true; }
} // namespace hal