Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Unix.utimes under Windows may shift timestamp depending on DST setting #7660
Original bug ID: 7660
#7385 strikes back!
When "Adjust for daylight saving time automatically" is ON in your Windows settings, the function Unix.utimes can shift the passed timestamp by one hour depending on DST. If the setting is OFF the timestamp seems to be left unchanged.
It MAY be that this bug only became more evident due to the fix for #7385, which solved a similar issue for Unix.stat. Before that, the two functions's bugs may have cancelled each other. (This is just a guess, I did not verify it.)
Steps to reproduce
Set "Adjust for daylight saving time automatically" to ON
$ touch foo.txt
let t0 = 1508391026.;;
val t0 : float = 1508391026.
Unix.utimes "foo.txt" t0 t0;;
let t1 = (Unix.stat "foo.txt").Unix.st_mtime;;
val t1 : float = 1508387426.
t0 -. t1;;
You can check on Cygwin that the mtime is the correct one, so the problem
is with Unix.utimes, not Unix.stat:
$ stat --format=%Y foo.txt