mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
alif/fatfs_port: Implement get_fattime.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -24,15 +24,12 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "py/mphal.h"
|
||||||
|
#include "shared/timeutils/timeutils.h"
|
||||||
#include "lib/oofatfs/ff.h"
|
#include "lib/oofatfs/ff.h"
|
||||||
|
|
||||||
DWORD get_fattime(void) {
|
DWORD get_fattime(void) {
|
||||||
// TODO
|
timeutils_struct_time_t tm;
|
||||||
int year = 2024;
|
timeutils_seconds_since_epoch_to_struct_time(mp_hal_time_get(NULL), &tm);
|
||||||
int month = 1;
|
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);
|
||||||
int day = 1;
|
|
||||||
int hour = 0;
|
|
||||||
int min = 0;
|
|
||||||
int sec = 0;
|
|
||||||
return ((year - 1980) << 25) | (month << 21) | (day << 16) | (hour << 11) | (min << 5) | (sec / 2);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user