From 92899354d96a5b5463f3002b2476a73c11ebe626 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 29 Jul 2020 01:01:31 +1000 Subject: [PATCH] unix/fatfs_port: Implement get_fattime. Signed-off-by: Damien George --- ports/unix/fatfs_port.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ports/unix/fatfs_port.c b/ports/unix/fatfs_port.c index 30f1959f52..4ec5b919ab 100644 --- a/ports/unix/fatfs_port.c +++ b/ports/unix/fatfs_port.c @@ -1,5 +1,13 @@ +#include #include "lib/oofatfs/ff.h" DWORD get_fattime(void) { - return 0; + time_t now = time(NULL); + struct tm *tm = localtime(&now); + return ((1900 + tm->tm_year - 1980) << 25) + | (tm->tm_mon << 21) + | (tm->tm_mday << 16) + | (tm->tm_hour << 11) + | (tm->tm_min << 5) + | (tm->tm_sec / 2); }