FS#9788: Include timestamp in logf filename (Yoshihisa Uchida)

For example, logf_202007071157.txt

Change-Id: Ia50c0ca67772e3d26b49dd8e1a3519816e5211c6
This commit is contained in:
Solomon Peachy 2020-07-07 11:56:45 -04:00
parent 52325a7c01
commit 8fc5e33ae1

View file

@ -221,6 +221,10 @@ bool logfdisplay(void)
bool logfdump(void)
{
int fd;
#if CONFIG_RTC
struct tm *nowtm;
char fname[MAX_PATH];
#endif
splashf(HZ, "Log File Dumped");
@ -231,7 +235,15 @@ bool logfdump(void)
logfenabled = false;
#if CONFIG_RTC
nowtm = get_time();
snprintf(fname, MAX_PATH, "%s/logf_%04d%02d%02d%02d%02d%02d.txt", ROCKBOX_DIR,
nowtm->tm_year + 1900, nowtm->tm_mon + 1, nowtm->tm_mday,
nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec);
fd = open(fname, O_CREAT|O_WRONLY|O_TRUNC);
#else
fd = open(ROCKBOX_DIR "/logf.txt", O_CREAT|O_WRONLY|O_TRUNC, 0666);
#endif
if(-1 != fd) {
int i;