Problem with Daylight saving time
I've been using the .Net assembly (5.0.6 beta) and powershell to write a simple download script.
The script logs in, traverses the directory tree and downloads all files that have been modified since last time.
It connect to a SFTP-server running on centos. When I use the WinSCP gui to connect, all timestamps are reported correctly (using "adjust remote timestamp to local conventions").
When using my script however the time of the remote files lastWrite is pushed one hour back in time.
I've been reading a lot on the forum and in the documentations and I guess that my problem is related to:
https://winscp.net/eng/docs/ui_login_environment#dst
https://winscp.net/eng/docs/timestamp
I've tested to set ConsiderDST to both 0 and 1 and using it with and without the preserve flag. Setting it to 0 makes the time shift 2hours back in time and setting it to 1 makes the shift 1hour.
My connection code is straight forward.
I've also tested:
Whatever I do the times are haunting me and I'm starting to feel that there might be some kind of bug in play as I can connect to the server just fine using the WinSCP GUI client but not with the .Net assembly.
Any help would be appreciated.
/Lukas
The script logs in, traverses the directory tree and downloads all files that have been modified since last time.
It connect to a SFTP-server running on centos. When I use the WinSCP gui to connect, all timestamps are reported correctly (using "adjust remote timestamp to local conventions").
When using my script however the time of the remote files lastWrite is pushed one hour back in time.
I've been reading a lot on the forum and in the documentations and I guess that my problem is related to:
https://winscp.net/eng/docs/ui_login_environment#dst
https://winscp.net/eng/docs/timestamp
I've tested to set ConsiderDST to both 0 and 1 and using it with and without the preserve flag. Setting it to 0 makes the time shift 2hours back in time and setting it to 1 makes the shift 1hour.
My connection code is straight forward.
# Setup session options $options = New-Object WinSCP.SessionOptions $options.Protocol = [WinSCP.Protocol]::sFtp $options.HostName = $remoteServer $options.UserName = $remoteUser $options.Password = $remotePassword $options.SshHostKey = "ssh-rsa 2048 9e:8a:5e:3b:e3:85:cd:97:46:5a:1e:53:2c:c0:b2:87" $options.AddRawSettings("PreserveTime", 1); $options.AddRawSettings("ConsiderDST", 0); $session = New-Object WinSCP.Session try { # Connect to SFTP server write-host "Connecting to SFTP server at " $options.HostName $session.Open($options) .... }
#Dissable defaultConfig and load ini file that works with GUI $session.DefaultConfiguration=$FALSE; $session.iniFilePath="./winscp.ini"; #Put the flags as exec arguments $session.AdditionalExecutableArguments="/ConsiderDST=0 /PreserveTime=1"
Any help would be appreciated.
/Lukas