From 4eefd2683b7f087c2ff19de24456f6493034757e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 23 Oct 2013 23:27:09 +1100 Subject: [PATCH] DataFlash: show timestamps on flash logs --- libraries/DataFlash/DataFlash_File.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libraries/DataFlash/DataFlash_File.cpp b/libraries/DataFlash/DataFlash_File.cpp index 86ac9391dd..e1c2571992 100644 --- a/libraries/DataFlash/DataFlash_File.cpp +++ b/libraries/DataFlash/DataFlash_File.cpp @@ -22,6 +22,7 @@ #include #include #include +#include extern const AP_HAL::HAL& hal; @@ -395,10 +396,19 @@ void DataFlash_File::ListAvailableLogs(AP_HAL::BetterStream *port) if (filename != NULL) { size = _get_log_size(log_num); if (size != 0) { - port->printf_P(PSTR("Log %u in %s of size %u\n"), - (unsigned)log_num, - filename, - (unsigned)size); + struct stat st; + if (stat(filename, &st) == 0) { + struct tm *tm = gmtime(&st.st_mtime); + port->printf_P(PSTR("Log %u in %s of size %u %u/%u/%u %u:%u\n"), + (unsigned)log_num, + filename, + (unsigned)size, + (unsigned)tm->tm_year+1900, + (unsigned)tm->tm_mon+1, + (unsigned)tm->tm_mday, + (unsigned)tm->tm_hour, + (unsigned)tm->tm_min); + } } free(filename); }