We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 39ee12d commit b61cf8dCopy full SHA for b61cf8d
ports/atmel-samd/fatfs_port.c
@@ -28,8 +28,13 @@
28
#include "py/runtime.h"
29
#include "lib/oofatfs/ff.h" /* FatFs lower layer API */
30
#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */
31
+#include "lib/timeutils/timeutils.h"
32
+#include "shared-bindings/rtc/RTC.h"
33
34
DWORD get_fattime(void) {
- // TODO(tannewt): Support the RTC.
- return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2);
35
+ timeutils_struct_time_t tm;
36
+ common_hal_rtc_get_time(&tm);
37
+
38
+ return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) |
39
+ (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
40
}
0 commit comments