Skip to content

Commit

Permalink
unix/fatfs_port: Implement get_fattime.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Aug 22, 2020
1 parent 55c76ea commit 9289935
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ports/unix/fatfs_port.c
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 9289935

Please sign in to comment.