mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 05:57:34 +08:00
Linux helpers
This commit is contained in:
@@ -60,12 +60,6 @@ class SystemClock : public uavcan::ISystemClock
|
||||
return adjtime(&tv, nullptr) == 0;
|
||||
}
|
||||
|
||||
static ClockAdjustmentMode detectPreferredClockAdjustmentMode()
|
||||
{
|
||||
const bool godmode = geteuid() == 0;
|
||||
return godmode ? ClockAdjustmentMode::SystemWide : ClockAdjustmentMode::PerDriverPrivate;
|
||||
}
|
||||
|
||||
public:
|
||||
SystemClock(ClockAdjustmentMode adj_mode = detectPreferredClockAdjustmentMode())
|
||||
: gradual_adj_limit_(uavcan::UtcDuration::fromMSec(4000))
|
||||
@@ -147,6 +141,12 @@ public:
|
||||
{
|
||||
return getStepAdjustmentCount() + getGradualAdjustmentCount();
|
||||
}
|
||||
|
||||
static ClockAdjustmentMode detectPreferredClockAdjustmentMode()
|
||||
{
|
||||
const bool godmode = geteuid() == 0;
|
||||
return godmode ? ClockAdjustmentMode::SystemWide : ClockAdjustmentMode::PerDriverPrivate;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user