summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-07-07 11:56:45 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-07-07 15:58:51 +0000
commit8fc5e33ae1ab5712d6ed53dbcb8f60fd6e628198 (patch)
tree269b08b241b5872bfb995d0839c551231fa45bdc
parent52325a7c016f19a711e25f2f381b34d95c95f46a (diff)
downloadrockbox-8fc5e33ae1ab5712d6ed53dbcb8f60fd6e628198.tar.gz
rockbox-8fc5e33ae1ab5712d6ed53dbcb8f60fd6e628198.tar.bz2
rockbox-8fc5e33ae1ab5712d6ed53dbcb8f60fd6e628198.zip
FS#9788: Include timestamp in logf filename (Yoshihisa Uchida)
For example, logf_202007071157.txt Change-Id: Ia50c0ca67772e3d26b49dd8e1a3519816e5211c6
-rw-r--r--apps/logfdisp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/logfdisp.c b/apps/logfdisp.c
index 54c345faae..20d737e924 100644
--- a/apps/logfdisp.c
+++ b/apps/logfdisp.c
@@ -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;