Index wasi args_get args_sizes_get clock_res_get clock_time_get environ_get environ_sizes_get fd_advise fd_allocate fd_close fd_datasync fd_fdstat_get fd_fdstat_set_flags fd_fdstat_set_rights fd_filestat_get fd_filestat_set_size fd_filestat_set_times fd_pread fd_prestat_dir_name fd_prestat_get fd_pwrite fd_read fd_readdir fd_renumber fd_seek fd_sync fd_tell fd_write file_stat_flags filestat iovec lookup_flags path_create_directory path_filestat_get path_filestat_set_times path_link path_open path_readlink path_remove_directory path_rename path_symlink path_unlink_file poll_oneoff proc_exit proc_raise random_get sched_yield sock_accept sock_recv sock_send sock_shutdown
Set timestamp metadata on a file
fd_filestat_set_times (
fd: i32The file descriptor of the file to set the timestamp metadatast_atime: i32The last accessed time to setst_mtime: i32The last modified time to setcontrol: fst_flagsA bit-vector that controls which times to set
) =>
error: i32 

The fd_filestat_set_times() function is used to set the timestamp metadata on a file identified by a file descriptor. It allows modifying the last accessed time (st_atime) and last modified time (st_mtime) of the file. The function also provides a bit-vector (fst_flags) to control which times should be set.

In POSIX systems, files have associated timestamp metadata that stores information about the file's access and modification times. The fd_filestat_set_times() function enables applications to update these timestamps. It allows setting the last accessed and last modified times to specific values or using the current time.

Note

The fd_filestat_set_times() function allows setting the timestamp metadata of a file identified by the provided file descriptor. Applications can specify the last accessed and last modified times using the provided parameters. The fst_flags bit-vector is used to control which times should be set.

Please note that if both SET_ATIME and SET_ATIME_NOW flags are set, or if both SET_MTIME and SET_MTIME_NOW flags are set in fst_flags, the function will return Errno::Inval.

Read More