Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Problem with handling of Windows setting re Auto Adjust DST

I have tried to summarize and explain current WinSCP behaviour in documentation. For feedback please follow to this topic.
martin

Re: Problem with handling of Windows setting re Auto Adjust DST

I've spent some time trying to find a solution. Unfortunatelly I was not successful.

What I've learned:
Currently DST is on, my timezone is CET (GMT+1). "Auto adjust DST" is on in Windows. In this situation I need to adjust remote UTC timestamp of file created out-of-DST by 3 hours to display the same time the Windows Explorer would. I know this from experience, I cannot explain it. Common sense would suggest 2 hours (1 for timezone, 1 for DST). However Windows treats timestamp in some strange way of its own. Particularly it shifts timestamp by 2 hours for DST. You have noticed that I subtract DaylightDifference twice. This is actually hack to achieve the 3 hours difference. This proved to work (until now).

If I switch off the "Auto adjust DST", Windows Explorer decreases timestamp by one hour. However in the situation DaylightDifference is zero, making WinSCP shift the timestamp by 1 hour, instead of correct 2. I do not know how to achieve the correct behaviour.

So I believe that problem is not that I subtract DaylightDifference twice as it is zero anyway.
martin

Re: Problem with handling of Windows setting re Auto Adjust DST

jplumbley wrote:

I've done some further tests myself and also read some of the WinSCP source code. In particular the routines UnixToDateTime, DateTimeToFileTime and ConvertTimestampToUnix. For example in the UnixToDateTime routine I can see it subtracts Params->CurrentDifference (which may include the DaylightDifference) but then goes on (if ConsiderDST is set) to maybe subtract the DaylightDifference again. I think this is what is causing my problem.

Thanks for your analysis. I'll check it.
jplumbley

Re: Problem with handling of Windows setting re Auto Adjust DST

martin wrote:

This still apears to be a problem in the latest version of WinSCP.
Is there any further info that I could supply which would be helpful to you?

Sorry, I haven't time to try to investigate the problem before the last release. It's still on the TODO list though.

I've done some further tests myself and also read some of the WinSCP source code. In particular the routines UnixToDateTime, DateTimeToFileTime and ConvertTimestampToUnix. For example in the UnixToDateTime routine I can see it subtracts Params->CurrentDifference (which may include the DaylightDifference) but then goes on (if ConsiderDST is set) to maybe subtract the DaylightDifference again. I think this is what is causing my problem.

I have now come to the conclusion that I should configure WinSCP with "Server Adjusts DST" even though my server is unix. This then looks as though it will solve my problem (both now and after the imminent DST change). However this would then mean I would have this option configured in the opposite way to what the documentation indicates is needed for a unix server:
Some servers (mostly on Windows) adjust file timestamp with start of DST and some not (Unix). The option selects between the two approaches

It looks as though (with SFTP) the code is implementing this option back to front.
AG

Re: Problem with handling of Windows setting re Auto Adjust DST

martin wrote:

Have you read the documentation? Does it help?

Yes, that actually helps, thanks!
martin

Re: Problem with handling of Windows setting re Auto Adjust DST

AG wrote:

I am experiencing a similar problem which might have the same root: WinSCP displays remote modification time 1 hour ahead of what ls reports. This is not affected by WinSCP Environment DST setting. My WinXP DST is always on and I live in GMT+5

Have you read the documentation? Does it help?
martin

Re: Problem with handling of Windows setting re Auto Adjust DST

This still apears to be a problem in the latest version of WinSCP.
Is there any further info that I could supply which would be helpful to you?

Sorry, I haven't time to try to investigate the problem before the last release. It's still on the TODO list though.
AG

Re: Problem with handling of Windows setting re Auto Adjust DST

I am experiencing a similar problem which might have the same root: WinSCP displays remote modification time 1 hour ahead of what ls reports. This is not affected by WinSCP Environment DST setting. My WinXP DST is always on and I live in GMT+5
Guest

Re: Problem with handling of Windows setting re Auto Adjust DST

Hi,

This still apears to be a problem in the latest version of WinSCP.
Is there any further info that I could supply which would be helpful to you?

Regards
John.
jplumbley

Re: Problem with handling of Windows setting re Auto Adjust DST

oops, I meant to say...
...If I don't set my PC's date and time setting to "Automatically adjust clock for daylight saving changes" then the datestamp shown for remote files (and local files) are all correct.
When I enable the setting "Automatically adjust clock for daylight saving changes" then the timestamp of...
martin

Re: Problem with handling of Windows setting re Auto Adjust DST

I'll check it. Thanks for info.
jplumbley

Problem with handling of Windows setting re Auto Adjust DST

Hello,
I have what I think is a problem with the timestamp that WinSCP shows for remote files. The problem disappears if I turn off the windows date and time properties setting "Automatically adjust clock for daylight saving changes".
Details are:
winscp 3.7.4 (running on on winxp with sp2)
with setting "Server works in UTC time (adjust DST locally)"
with interface "Norton Commander"
Protocol is SFTP(v3)
The server is Linux running openSSH
My PC's timezone is set to 'GMT London' and currently DST is in force.
If I set my PC's date and time setting to "Automatically adjust clock for daylight saving changes" then the datestamp shown for remote files (and local files) are all correct.
When I uncheck the setting "Automatically adjust clock for daylight saving changes" then the timestamp of...
i) a recent remote file - increases by +2 <<<<<< I THINK THIS SHOULD BE +1
ii) a 6 month old remote file - increases by +1 (as expected)
iii) a recent local file - increases by +1 (as expected)
iv) a 6 month old local file - increases by +1 (as expected)
In other words it is as though WinSCP is adjusting the timestamp of all files by +1 and then an extra erroneous +1 for remote files whose timestamp falls within a DST period.

n.b. None of the above remote files were transferred by WinSCP, they were existing remote files whose details were being viewed.
n.b. There is no problem when viewing the details of the same remote files using Filezilla using SFTP.

Thanks,
John.