Skip to content

Unix file timestamps only have one-second granularity #18870

@mellinoe

Description

@mellinoe

Currently, method such as File.GetLastWriteTime and FileInfo.LastWriteTime return timestamps which are only accurate to the nearest second on Unix. On OSX, this seems to be a system-level limitation in HFS+. On most Linux filesystems, however, millisecond-level information does seem to be available, at least via stat. @stephentoub recommended that we could use utimes rather than utime in the native shim in order to retrieve this information.

This also seems to affect files copied by File.Copy, because we copy over some timestamp metadata from the source file (to match Windows).

Metadata

Metadata

Assignees

Labels

area-System.IOenhancementProduct code improvement that does NOT require public API changes/additionshelp wanted[up-for-grabs] Good issue for external contributors

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions