Skip to content

moduos: Add os.utime() support to vfs layer and LFS2, FAT and posix filesystems. #9644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

glenn20
Copy link
Contributor

@glenn20 glenn20 commented Oct 17, 2022

This PR adds support for os.utime(filename, (atime, mtime)).

This is especially useful for preserving timestamps of files and directory stuctures copied onto (or sunchronised) between micropython boards and host systems or for managing file timestamps.

Support is provided for LittleFS2, FAT and posix filesystems.

@glenn20 glenn20 force-pushed the feature_moduos_utime branch 3 times, most recently from efb6cd7 to abc4d3c Compare October 17, 2022 09:08
@glenn20 glenn20 changed the title moduos: Add os.utime() support to vfs layer and LFS, FAT and posix filesystems. moduos: Add os.utime() support to vfs layer and LFS2, FAT and posix filesystems. Oct 17, 2022
@glenn20 glenn20 force-pushed the feature_moduos_utime branch from abc4d3c to a141dc0 Compare October 17, 2022 10:59
@glenn20
Copy link
Contributor Author

glenn20 commented Oct 17, 2022

OK - all ports are compiling successfully now, including windows with gcc-mingw64.
(Appveyor is failing with build on msvc due to missing utime.h).

@glenn20 glenn20 force-pushed the feature_moduos_utime branch from a141dc0 to 1e6b44b Compare October 31, 2022 06:09
@dpgeorge dpgeorge added the extmod Relates to extmod/ directory in source label Jan 18, 2023
glenn20 added 4 commits April 2, 2023 15:56
Add utime() method to uos module via vfs layer:
- Does not support "ns", "dir_fd" or "follow_symlinks" arguments from
  cpython.
- utimes=None is not supported on qemu-arm due to lack of
  mp_hal_time_ns() support.
Uses utime() system call instead of utimes(). utime() has been
obsoleted in posix.1-2008, but utimes() is not supported on windows
(compiled with gcc-mingw-w64).
@glenn20 glenn20 force-pushed the feature_moduos_utime branch from 1e6b44b to 4475fe4 Compare April 2, 2023 05:58
@github-actions
Copy link

github-actions bot commented Apr 2, 2023

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64: +2744 +0.345% standard[incl +200(data)]
      stm32:  +620 +0.158% PYBV10
        rp2:  +624 +0.192% PICO

@projectgus
Copy link
Contributor

This is an automated heads-up that we've just merged a Pull Request
that removes the STATIC macro from MicroPython's C API.

See #13763

A search suggests this PR might apply the STATIC macro to some C code. If it
does, then next time you rebase the PR (or merge from master) then you should
please replace all the STATIC keywords with static.

Although this is an automated message, feel free to @-reply to me directly if
you have any questions about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extmod Relates to extmod/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants