File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-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
+
31
+ extern void common_hal_rtc_get_time (timeutils_struct_time_t * tm );
32
+ extern void struct_time_to_tm (mp_obj_t t , timeutils_struct_time_t * tm );
29
33
30
34
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 );
35
+ #if CIRCUITPY_RTC
36
+ timeutils_struct_time_t tm ;
37
+ common_hal_rtc_get_time (& tm );
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
+ #else
41
+ return ((2016 - 1980 ) << 25 ) | ((9 ) << 21 ) | ((1 ) << 16 ) | ((16 ) << 11 ) | ((43 ) << 5 ) | (35 / 2 );
42
+ #endif
33
43
}
You can’t perform that action at this time.
0 commit comments