Linux helpers

This commit is contained in:
Pavel Kirienko
2014-03-31 20:23:26 +04:00
parent 788d7348b6
commit c80e0388eb
4 changed files with 155 additions and 8 deletions
@@ -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;
}
};
}