mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-14 05:03:34 +08:00
add back utc_offset param, uncomment px4_clock_gettime
This commit is contained in:
@@ -1293,12 +1293,9 @@ int Logger::get_log_file_name(LogType type, char *file_name, size_t file_name_si
|
||||
|
||||
time_t timestamp_utc = {};
|
||||
struct timespec ts = {};
|
||||
// px4_clock_gettime(CLOCK_REALTIME, &ts);
|
||||
px4_clock_gettime(CLOCK_REALTIME, &ts);
|
||||
timestamp_utc = ts.tv_sec + (ts.tv_nsec / 1e9);
|
||||
|
||||
tm tt = {};
|
||||
gmtime_r(×tamp_utc, &tt);
|
||||
|
||||
const char *replay_suffix = "";
|
||||
|
||||
if (_replay_file_name) {
|
||||
@@ -1318,6 +1315,13 @@ int Logger::get_log_file_name(LogType type, char *file_name, size_t file_name_si
|
||||
|
||||
// Check if time is non-zero for valid UTC timestamp
|
||||
if (timestamp_utc > 0) {
|
||||
int offset = _param_sdlog_utc_offset.get() * 60;
|
||||
if (timestamp_utc > abs(offset)) {
|
||||
timestamp_utc += offset;
|
||||
}
|
||||
|
||||
tm tt = {};
|
||||
gmtime_r(×tamp_utc, &tt);
|
||||
|
||||
// TODO: move create_log_dir outside of this...
|
||||
int n = create_log_dir(type, &tt, file_name, file_name_size);
|
||||
|
||||
Reference in New Issue
Block a user