DataFlash: show timestamps on flash logs

This commit is contained in:
Andrew Tridgell 2013-10-23 23:27:09 +11:00
parent 34cde1a640
commit 6b2222c32e
1 changed files with 14 additions and 4 deletions

View File

@ -22,6 +22,7 @@
#include <assert.h>
#include <AP_Math.h>
#include <stdio.h>
#include <time.h>
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);
}