mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-28 19:48:31 -04:00
AP_HAL_Linux: clarify method name, use common methods for setting time
This commit is contained in:
parent
e92b3f0a63
commit
c9dbdd7a5c
@ -84,21 +84,20 @@ void Util::_toneAlarm_timer_tick() {
|
||||
} else if (state == 3) {
|
||||
state = 1;
|
||||
}
|
||||
|
||||
|
||||
if (_toneAlarm.is_tune_comp()) {
|
||||
state = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Util::set_system_clock(uint64_t time_utc_usec)
|
||||
void Util::set_hw_rtc(uint64_t time_utc_usec)
|
||||
{
|
||||
#if CONFIG_HAL_BOARD_SUBTYPE != HAL_BOARD_SUBTYPE_LINUX_NONE
|
||||
timespec ts;
|
||||
ts.tv_sec = time_utc_usec/1000000ULL;
|
||||
ts.tv_nsec = (time_utc_usec % 1000000ULL) * 1000ULL;
|
||||
clock_settime(CLOCK_REALTIME, &ts);
|
||||
#endif
|
||||
// call superclass method to set time. We've guarded this so we
|
||||
// don't reset the HW clock time on people's laptops.
|
||||
AP_HAL::Util::set_hw_rtc(time_utc_usec);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Util::is_chardev_node(const char *path)
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
/*
|
||||
set system clock in UTC microseconds
|
||||
*/
|
||||
void set_system_clock(uint64_t time_utc_usec);
|
||||
void set_hw_rtc(uint64_t time_utc_usec) override;
|
||||
const char *get_custom_log_directory() const override final { return custom_log_directory; }
|
||||
const char *get_custom_terrain_directory() const override final { return custom_terrain_directory; }
|
||||
const char *get_custom_storage_directory() const override final { return custom_storage_directory; }
|
||||
|
Loading…
Reference in New Issue
Block a user