mirror of https://github.com/ArduPilot/ardupilot
AP_Stats: add and use an AP_RTC_config.h
This commit is contained in:
parent
93cd64ad36
commit
23f5fcffb2
|
@ -108,6 +108,7 @@ void AP_Stats::update()
|
||||||
params.flttime.set_and_save_ifchanged(0);
|
params.flttime.set_and_save_ifchanged(0);
|
||||||
params.runtime.set_and_save_ifchanged(0);
|
params.runtime.set_and_save_ifchanged(0);
|
||||||
uint32_t system_clock = 0; // in seconds
|
uint32_t system_clock = 0; // in seconds
|
||||||
|
#if AP_RTC_ENABLED
|
||||||
uint64_t rtc_clock_us;
|
uint64_t rtc_clock_us;
|
||||||
if (AP::rtc().get_utc_usec(rtc_clock_us)) {
|
if (AP::rtc().get_utc_usec(rtc_clock_us)) {
|
||||||
system_clock = rtc_clock_us / 1000000;
|
system_clock = rtc_clock_us / 1000000;
|
||||||
|
@ -115,6 +116,7 @@ void AP_Stats::update()
|
||||||
// time base to Jan 1st 2016:
|
// time base to Jan 1st 2016:
|
||||||
system_clock -= 1451606400;
|
system_clock -= 1451606400;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
params.reset.set_and_save_ifchanged(system_clock);
|
params.reset.set_and_save_ifchanged(system_clock);
|
||||||
copy_variables_from_parameters();
|
copy_variables_from_parameters();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue