AP_Stats: add and use an AP_RTC_config.h

This commit is contained in:
Peter Barker 2023-10-04 18:03:33 +11:00 committed by Andrew Tridgell
parent 93cd64ad36
commit 23f5fcffb2
1 changed files with 2 additions and 0 deletions

View File

@ -108,6 +108,7 @@ void AP_Stats::update()
params.flttime.set_and_save_ifchanged(0);
params.runtime.set_and_save_ifchanged(0);
uint32_t system_clock = 0; // in seconds
#if AP_RTC_ENABLED
uint64_t rtc_clock_us;
if (AP::rtc().get_utc_usec(rtc_clock_us)) {
system_clock = rtc_clock_us / 1000000;
@ -115,6 +116,7 @@ void AP_Stats::update()
// time base to Jan 1st 2016:
system_clock -= 1451606400;
}
#endif
params.reset.set_and_save_ifchanged(system_clock);
copy_variables_from_parameters();
}