unix/fatfs_port: Implement get_fattime.

Signed-off-by: Damien George <damien@micropython.org>
v1.13-wasp-os
Damien George 2020-07-29 01:01:31 +10:00
parent 55c76eaac1
commit 92899354d9
1 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,13 @@
#include <time.h>
#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);
}