Changed Times off by 1 hour when local in DST

Advertisement

Norm
Guest

Changed Times off by 1 hour when local in DST

I'm having a problem similar to mr in this thread:
https://winscp.net/forum/viewtopic.php?t=2381

which is to say that WinSCP (ver 3.7.6 build 306, running on Windows 98SE) is displaying the "Changed" time of files on the Remote to be 1 hour later than correct (as determined by "ls" on the server).

For example, I gathered two files, one that was created during DST and one not. (My local and remote are in the EST zone) When I "ls --full" these files on the server, I get:

-rw-r--r-- 1 nlyon nlyon 1432 2002-10-22 16:13:44.000000000 -0400 DST16_13_44
-rw-r--r-- 1 nlyon nlyon 2041 2004-01-18 20:49:28.000000000 -0500 EST20_49_28

In WinSCP, I have the DST option set to "Server works in UTC time" and the remote's Changed times are 5:13:44 PM and 9:49:28 PM, i.e. 1 hour later than "correct".

Changing to "Server adjusts DST" mode does NOT help in my case, as the DST file is still listed as 1 hr advanced, and the EST file is listed as 2 (!) hrs advanced.

Next, I changed my local's calendar to Oct 31, which is after the change back from DST. I restarted Windows and WinSCP, and now the remote's Changed times are correct! (Since ver 3.7.6 was released in the summer during DST, I wonder if there will be an increase in problem reports when the clocks change back this fall.)

I'm looking forward to using the Synchronize function, but I think the DST change will screw up WinSCP's view of what needs to be synchronized.

I've also tried specifying a -1 hr server time zone offset in WinSCP. This causes the time to display correctly, at least during DST (did not check outside of DST) BUT it introduces a 1 hr delta between the timestamps on the local and remote, and Synchronize thinks the local files (copied from the remote) are now newer. Hence this is not a solution either.

I am also running SCP (server apparently does not support SFTP) so I cannot try workarounds involving synchronizing the timestamps only.

To close, my speculation is that WinSCP is incorrectly applying DST adjustment; it appears to be shifting the Changed time of ALL files (those created in and out of DST) based on whether the local machine is currently in DST. I think I would have expected the shift to be dependent on whether the file was created during DST. (But hey, I've been wrong before. :D )

Other than that, WinSCP has been great!!

- Norm.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Changed Times off by 1 hour when local in DST

Do you have DST adjustment enabled in Windows?
_________________
Martin Prikryl

Reply with quote

Norm
Guest

Re: Changed Times off by 1 hour when local in DST

martin wrote:

Do you have DST adjustment enabled in Windows?
Yes. Specifically, in the Date/Time Properties dialog, the box labelled "Automatically adjust clock for daylight saving changes" is checked. And the time zone is set to "(GMT-05:00) Eastern Time (US & Canada)"

- Norm.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Changed Times off by 1 hour when local in DST

Then sorry, I have no idea what can be a cause of your problems.
_________________
Martin Prikryl

Reply with quote

Norm
Guest

I've been looking at the winscp code.

The first significant thing I found was the comment in TRemoteFile::SetListingStr which reads:
        // skip TZ (TODO)    
and sure enough, that code does not use the time zone info (really the file timestamp offset from UTC in my case) from the data returned from the ls --full-time. So this suggests to me that I should be focusing more on using the winscp mode "Server adjusts DST" since winscp is ignoring the offset info and using only the local time portion of the ls output. Correct?

The next thing I found looks suspicious. Consider these lines of code in AdjustDateTimeFromUnix (Common.cpp):
TDateTimeParams * Params = GetDateTimeParams();
DateTime = DateTime - Params->CurrentDaylightDifference;    
AdjustDateTimeFromUnix is called from TRemoteFile::SetListingStr and DateTime is the Unix file timestamp. But CurrentDaylightDifference is the daylight offset for TODAY on the local machine, isn't it? Seems wrong to shift a file timestamp based on today's date (as opposed to the file date), doesn't it?

- Norm.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Thanks. I'll look into it.
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum