@@ -415,18 +415,23 @@ STATIC mp_obj_t vfs_fat_umount(mp_obj_t self_in) {
415
415
}
416
416
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (fat_vfs_umount_obj , vfs_fat_umount );
417
417
418
- STATIC mp_obj_t vfs_fat_utime (mp_obj_t vfs_in , mp_obj_t path_in , mp_obj_t time_in ) {
418
+ STATIC mp_obj_t vfs_fat_utime (mp_obj_t vfs_in , mp_obj_t path_in , mp_obj_t times_in ) {
419
419
mp_obj_fat_vfs_t * self = MP_OBJ_TO_PTR (vfs_in );
420
420
const char * path = mp_obj_str_get_str (path_in );
421
- const int time = mp_obj_get_int (time_in );
421
+ if (!mp_obj_is_tuple_compatible (times_in )) {
422
+ mp_raise_type_arg (& mp_type_TypeError , times_in );
423
+ }
422
424
425
+ mp_obj_t * times ;
426
+ mp_obj_get_array_fixed_n (times_in , 2 , & times );
427
+ const int atime = mp_obj_get_int (times [0 ]);
428
+ const int mtime = mp_obj_get_int (times [1 ]);
423
429
timeutils_struct_time_t tm ;
424
- timeutils_seconds_since_epoch_to_struct_time (time , & tm );
430
+ timeutils_seconds_since_epoch_to_struct_time (atime , & tm );
425
431
426
432
FILINFO fno ;
427
433
fno .fdate = (WORD )(((tm .tm_year - 1980 ) * 512U ) | tm .tm_mon * 32U | tm .tm_mday );
428
434
fno .ftime = (WORD )(tm .tm_hour * 2048U | tm .tm_min * 32U | tm .tm_sec / 2U );
429
-
430
435
FRESULT res = f_utime (& self -> fatfs , path , & fno );
431
436
if (res != FR_OK ) {
432
437
mp_raise_OSError_fresult (res );
0 commit comments