logger: -t param: fall back to px4_clock_gettime if there's no gps fix

This commit is contained in:
Beat Küng 2016-05-20 11:05:44 +02:00 committed by Lorenz Meier
parent a9930c2173
commit cd7c955067
1 changed files with 4 additions and 1 deletions

View File

@ -761,7 +761,10 @@ bool Logger::get_log_time(struct tm *tt, bool boot_time)
time_t utc_time_sec = gps_pos.time_utc_usec / 1e6;
if (gps_pos.fix_type < 2 || utc_time_sec < GPS_EPOCH_SECS) {
return false;
//take clock time if there's no fix (yet)
struct timespec ts;
px4_clock_gettime(CLOCK_REALTIME, &ts);
utc_time_sec = ts.tv_sec + (ts.tv_nsec / 1e9);
}
/* strip the time elapsed since boot */