Skip to content

Commit a65a33f

Browse files
committed
moduos: Try utime() instead of utimes() for windows support.
1 parent b525b31 commit a65a33f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

extmod/vfs_posix.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <stdio.h>
4141
#include <string.h>
4242
#include <sys/stat.h>
43+
#include <utime.h>
4344
#include <sys/time.h>
4445
#include <dirent.h>
4546
#ifdef _MSC_VER
@@ -339,12 +340,18 @@ STATIC mp_obj_t vfs_posix_utime(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t tim
339340
if (!mp_obj_is_type(times_in, &mp_type_tuple) || tuple->len != 2) {
340341
mp_raise_OSError(MP_EINVAL);
341342
}
343+
#if 0
342344
struct timeval times[2] = {
343345
{mp_obj_get_int(tuple->items[0]), 0},
344346
{mp_obj_get_int(tuple->items[1]), 0},
345347
};
348+
#else
349+
struct utimbuf times[1] = {
350+
{ mp_obj_get_int(tuple->items[0]), mp_obj_get_int(tuple->items[1]) }
351+
};
352+
#endif
346353
int ret;
347-
MP_HAL_RETRY_SYSCALL(ret, utimes(path, &times[0]), mp_raise_OSError(err));
354+
MP_HAL_RETRY_SYSCALL(ret, utime(path, &times[0]), mp_raise_OSError(err));
348355
return mp_const_none;
349356
}
350357
STATIC MP_DEFINE_CONST_FUN_OBJ_3(vfs_posix_utime_obj, vfs_posix_utime);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy