I am running Ubuntu 15.04 with a linux kernel 3.19.0-26-generic, my filesystem is the default ext4.
I run a test where I:
- Open/Write/Close a file.
- Get the modification time (from
stat
in nanoseconds) - Sleep for 1 millisecond
- Open/Write/Close the file again with different content.
- Get the new modification time (from
stat
in nanoseconds) - Compare the times from 2 and 5.
What I observe in about 50% of cases is that the two times are identical. I expected them to be always different (5 greater than 2).
Is it the case that the resolution of the modification times on ext4 is lower than nanosecond (even though stat can report nanosecond-accuracy), or is their a bug in my test? If ext4 stores lower than nanosecond accuracy, than what is the real resolution of the modification times? and where is this documented?