main/brewboard.c

changeset 93
24cb415af787
parent 92
bac0a860f5dd
child 119
1cef3c25426b
--- a/main/brewboard.c	Mon May 17 22:38:43 2021 +0200
+++ b/main/brewboard.c	Tue May 18 16:52:23 2021 +0200
@@ -85,9 +85,17 @@
     // Just to debug, list the /spiffs filesystem.
 #if 0
     DIR *dir = opendir("/spiffs");
+    struct stat st;
+    char strftime_buf[64], filename[280];
     struct dirent* de = readdir(dir);
     while (de) {
-	printf("%s\n", de->d_name);
+	snprintf(filename, 279, "/spiffs/%s", de->d_name);
+	if (stat(filename, &st) == 0) {
+	    strftime(strftime_buf, sizeof(strftime_buf), "%a, %d %b %Y %T %z", localtime(&(st.st_mtime)));
+	    printf("%5ld %s %s\n", st.st_size, strftime_buf, filename);
+	} else {
+	    printf("%d %s\n", stat(filename, &st), de->d_name);
+	}
 	de = readdir(dir);
     }
     closedir(dir);

mercurial