mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-29 20:18: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) {
|
} else if (state == 3) {
|
||||||
state = 1;
|
state = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_toneAlarm.is_tune_comp()) {
|
if (_toneAlarm.is_tune_comp()) {
|
||||||
state = 0;
|
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
|
#if CONFIG_HAL_BOARD_SUBTYPE != HAL_BOARD_SUBTYPE_LINUX_NONE
|
||||||
timespec ts;
|
// call superclass method to set time. We've guarded this so we
|
||||||
ts.tv_sec = time_utc_usec/1000000ULL;
|
// don't reset the HW clock time on people's laptops.
|
||||||
ts.tv_nsec = (time_utc_usec % 1000000ULL) * 1000ULL;
|
AP_HAL::Util::set_hw_rtc(time_utc_usec);
|
||||||
clock_settime(CLOCK_REALTIME, &ts);
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Util::is_chardev_node(const char *path)
|
bool Util::is_chardev_node(const char *path)
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
/*
|
/*
|
||||||
set system clock in UTC microseconds
|
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_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_terrain_directory() const override final { return custom_terrain_directory; }
|
||||||
const char *get_custom_storage_directory() const override final { return custom_storage_directory; }
|
const char *get_custom_storage_directory() const override final { return custom_storage_directory; }
|
||||||
|
Loading…
Reference in New Issue
Block a user