Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unix.utimes under Windows may shift timestamp depending on DST setting #7660

Closed
vicuna opened this issue Oct 24, 2017 · 3 comments
Closed

Unix.utimes under Windows may shift timestamp depending on DST setting #7660

vicuna opened this issue Oct 24, 2017 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Oct 24, 2017

Original bug ID: 7660
Reporter: @nojb
Status: resolved (set by @xavierleroy on 2017-12-20T16:59:37Z)
Resolution: fixed
Priority: normal
Severity: minor
OS: Windows
Version: 4.05.0
Target version: 4.07.0+dev/beta2/rc1/rc2
Fixed in version: 4.07.0+dev/beta2/rc1/rc2
Category: otherlibs
Monitored by: @gasche

Bug description

#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
$ ocaml unix.cma

let t0 = 1508391026.;;

val t0 : float = 1508391026.

Unix.utimes "foo.txt" t0 t0;;

  • : unit = ()

let t1 = (Unix.stat "foo.txt").Unix.st_mtime;;

val t1 : float = 1508387426.

t0 -. t1;;

  • : float = 3600.

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
1508387426

@vicuna
Copy link
Author

vicuna commented Oct 24, 2017

Comment author: @nojb

FYI, I tried to reproduce with commit 7fefb22, shortly before the merging of the the fix to Unix.stat. The bug is also there, but the difference t0 -. t1 is -3600. (!).

@vicuna
Copy link
Author

vicuna commented Oct 25, 2017

Comment author: @nojb

See #1445 for possible fix.

@vicuna
Copy link
Author

vicuna commented Dec 20, 2017

Comment author: @xavierleroy

Pull request was merged in trunk, will be in 4.07.

@vicuna vicuna closed this as completed Dec 20, 2017
@vicuna vicuna added this to the 4.07.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant