File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 * THE SOFTWARE.
2727 */
2828
29- #include "py/obj.h"
29+ #include <sys/time.h>
3030#include "lib/oofatfs/ff.h"
3131#include "timeutils.h"
32- //#include "modmachine.h"
3332
3433DWORD get_fattime (void ) {
35-
36- // TODO: Optimize division (there's no HW division support on ESP8266,
37- // so it's expensive).
38- //uint32_t secs = (uint32_t)(pyb_rtc_get_us_since_2000() / 1000000);
39- uint32_t secs = 0 ;
40-
34+ struct timeval tv ;
35+ gettimeofday (& tv , NULL );
4136 timeutils_struct_time_t tm ;
42- timeutils_seconds_since_2000_to_struct_time (secs , & tm );
37+ timeutils_seconds_since_2000_to_struct_time (tv . tv_sec , & tm );
4338
4439 return (((DWORD )(tm .tm_year - 1980 ) << 25 ) | ((DWORD )tm .tm_mon << 21 ) | ((DWORD )tm .tm_mday << 16 ) |
4540 ((DWORD )tm .tm_hour << 11 ) | ((DWORD )tm .tm_min << 5 ) | ((DWORD )tm .tm_sec >> 1 ));
You can’t perform that action at this time.
0 commit comments