File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 26
26
27
27
#include "py/runtime.h"
28
28
#include "lib/oofatfs/ff.h"
29
+ #include "lib/timeutils/timeutils.h"
30
+ #include "shared-bindings/rtc/RTC.h"
31
+ #include "shared-bindings/time/__init__.h"
29
32
30
33
DWORD get_fattime (void ) {
31
- // TODO: Implement this function. For now, fake it.
32
- return ((2016 - 1980 ) << 25 ) | ((12 ) << 21 ) | ((4 ) << 16 ) | ((00 ) << 11 ) | ((18 ) << 5 ) | (23 / 2 );
34
+ #if CIRCUITPY_RTC
35
+ timeutils_struct_time_t tm ;
36
+ common_hal_rtc_get_time (& tm );
37
+ return ((tm .tm_year - 1980 ) << 25 ) | (tm .tm_mon << 21 ) | (tm .tm_mday << 16 ) |
38
+ (tm .tm_hour << 11 ) | (tm .tm_min << 5 ) | (tm .tm_sec >> 1 );
39
+ #else
40
+ return ((2016 - 1980 ) << 25 ) | ((9 ) << 21 ) | ((1 ) << 16 ) | ((16 ) << 11 ) | ((43 ) << 5 ) | (35 / 2 );
41
+ #endif
33
42
}
You can’t perform that action at this time.
0 commit comments