mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41: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:
@@ -84,8 +84,7 @@ void NotifierThread::Main() {
|
||||
|
||||
// Wait until next alarm
|
||||
const Alarm& alarm = m_alarmQueue.top();
|
||||
int32_t status = 0;
|
||||
uint64_t curTime = HAL_GetFPGATime(&status);
|
||||
uint64_t curTime = HAL_GetMonotonicTime();
|
||||
if (alarm.notifier->alarmTime > curTime) {
|
||||
m_cond.wait_for(
|
||||
lock, std::chrono::microseconds{alarm.notifier->alarmTime - curTime});
|
||||
@@ -99,8 +98,7 @@ void NotifierThread::Main() {
|
||||
}
|
||||
|
||||
void NotifierThread::ProcessAlarms() {
|
||||
int32_t status = 0;
|
||||
uint64_t curTime = HAL_GetFPGATime(&status);
|
||||
uint64_t curTime = HAL_GetMonotonicTime();
|
||||
|
||||
while (!m_alarmQueue.empty() &&
|
||||
m_alarmQueue.top().notifier->alarmTime <= curTime) {
|
||||
@@ -190,7 +188,7 @@ void HAL_SetNotifierAlarm(HAL_NotifierHandle notifierHandle, uint64_t alarmTime,
|
||||
}
|
||||
|
||||
if (!absolute) {
|
||||
alarmTime += HAL_GetFPGATime(status);
|
||||
alarmTime += HAL_GetMonotonicTime();
|
||||
}
|
||||
|
||||
uint64_t prevWakeup = UINT64_MAX;
|
||||
|
||||
Reference in New Issue
Block a user