diff options
Diffstat (limited to 'src/offlinelogstorage')
-rw-r--r-- | src/offlinelogstorage/dlt_offline_logstorage_behavior.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c index 2637936..b9dc26c 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c +++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c @@ -89,16 +89,17 @@ void dlt_logstorage_log_file_name(char *log_file_name, if (file_config->logfile_timestamp) { char stamp[DLT_OFFLINE_LOGSTORAGE_TIMESTAMP_LEN + 1] = { 0 }; time_t t = time(NULL); - struct tm *tm_info = localtime(&t); + struct tm tm_info; + localtime_r(&t, &tm_info); sprintf(stamp, "%c%04d%02d%02d-%02d%02d%02d", file_config->logfile_delimiter, - 1900 + tm_info->tm_year, - 1 + tm_info->tm_mon, - tm_info->tm_mday, - tm_info->tm_hour, - tm_info->tm_min, - tm_info->tm_sec); + 1900 + tm_info.tm_year, + 1 + tm_info.tm_mon, + tm_info.tm_mday, + tm_info.tm_hour, + tm_info.tm_min, + tm_info.tm_sec); strcat(log_file_name, stamp); } |