From c64b0d45734c0eefffbe16c4a898c926de7826a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Mon, 6 Jun 2016 16:46:07 +0200 Subject: [PATCH] logger: don't use system time for log file name if system time obviously wrong --- src/modules/logger/logger.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/logger/logger.cpp b/src/modules/logger/logger.cpp index 5cc66d9c47..3a6a5b8c56 100644 --- a/src/modules/logger/logger.cpp +++ b/src/modules/logger/logger.cpp @@ -859,6 +859,10 @@ bool Logger::get_log_time(struct tm *tt, bool boot_time) struct timespec ts; px4_clock_gettime(CLOCK_REALTIME, &ts); utc_time_sec = ts.tv_sec + (ts.tv_nsec / 1e9); + + if (utc_time_sec < GPS_EPOCH_SECS) { + return false; + } } /* strip the time elapsed since boot */