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 0feb4f5 commit 46b366dCopy full SHA for 46b366d
ports/alif/fatfs_port.c
@@ -24,15 +24,12 @@
24
* THE SOFTWARE.
25
*/
26
27
+#include "py/mphal.h"
28
+#include "shared/timeutils/timeutils.h"
29
#include "lib/oofatfs/ff.h"
30
31
DWORD get_fattime(void) {
- // TODO
- int year = 2024;
32
- int month = 1;
33
- int day = 1;
34
- int hour = 0;
35
- int min = 0;
36
- int sec = 0;
37
- return ((year - 1980) << 25) | (month << 21) | (day << 16) | (hour << 11) | (min << 5) | (sec / 2);
+ timeutils_struct_time_t tm;
+ timeutils_seconds_since_epoch_to_struct_time(mp_hal_time_get(NULL), &tm);
+ return ((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);
38
}
0 commit comments