Bug 30083 - io-layer only has 1s resolution for file time information.
Summary: io-layer only has 1s resolution for file time information.
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-05-14 12:37 UTC by Jonathan Pryor
Modified: 2015-05-15 12:38 UTC (History)
3 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Jonathan Pryor 2015-05-14 12:37:58 UTC
io-layer only has 1s resolution for file time information.

This is (somewhat) problematic because e.g. the Microsoft/msbuild unit tests sleep for 100ms between creating files, expecting the file times to differ. Under mono, the file times don't differ, because io-layer uses the 1s-resolution `struct stat` members, not the 1ns members:


In order to get 1ns resolution, the `struct stat::st_mtimespec` and other `struct stat::st_*timespec` fields should be used instead of the `struct stat::st_*time` members.

Comment 1 Zoltan Varga 2015-05-15 10:46:27 UTC
The st_mtimespec.tv_nsec field seems to be 0 under osx, so it still cannot give sub second accuracy.
Comment 2 Jonathan Pryor 2015-05-15 12:38:32 UTC
Indeed, wikipedia mentions that HFS+ only supports 1s date resolution:


At least this should work on Linux...

Note You need to log in before you can comment on or make changes to this bug.