mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[hal,wpilib] Rename FPGA clock to monotonic clock (#8672)
- Remove status return from HAL level (clock getting should never fail) - Remove 32-bit timestamp expand function - Make monotonic_clock.hpp (formerly fpga_clock.hpp) header-only and move to root hal include directory
This commit is contained in:
@@ -25,7 +25,7 @@ static std::atomic<uint64_t> programStepTime{0};
|
||||
|
||||
namespace wpi::hal::init {
|
||||
void InitializeMockHooks() {
|
||||
wpi::util::SetNowImpl(GetFPGATime);
|
||||
wpi::util::SetNowImpl(GetMonotonicTime);
|
||||
}
|
||||
} // namespace wpi::hal::init
|
||||
|
||||
@@ -59,7 +59,7 @@ void StepTiming(uint64_t delta) {
|
||||
programStepTime += delta;
|
||||
}
|
||||
|
||||
uint64_t GetFPGATime() {
|
||||
uint64_t GetMonotonicTime() {
|
||||
uint64_t curTime = programPauseTime;
|
||||
if (curTime == 0) {
|
||||
curTime = wpi::util::NowDefault();
|
||||
@@ -67,10 +67,6 @@ uint64_t GetFPGATime() {
|
||||
return curTime + programStepTime - programStartTime;
|
||||
}
|
||||
|
||||
double GetFPGATimestamp() {
|
||||
return GetFPGATime() * 1.0e-6;
|
||||
}
|
||||
|
||||
void SetProgramStarted(bool started) {
|
||||
programStarted = started;
|
||||
}
|
||||
@@ -131,8 +127,7 @@ void HALSIM_StepTiming(uint64_t delta) {
|
||||
WaitNotifiers();
|
||||
|
||||
while (delta > 0) {
|
||||
int32_t status = 0;
|
||||
uint64_t curTime = HAL_GetFPGATime(&status);
|
||||
uint64_t curTime = HAL_GetMonotonicTime();
|
||||
uint64_t nextTimeout = HALSIM_GetNextNotifierTimeout();
|
||||
uint64_t step = (std::min)(delta, nextTimeout - curTime);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user