[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:
Peter Johnson
2026-03-15 15:08:41 -07:00
committed by GitHub
parent 1a5b023235
commit e944ae9aca
59 changed files with 233 additions and 358 deletions

View File

@@ -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);