Post a reply

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 Daylight saving time

Thanks for your report.
I have sent you an email with a development version of WinSCP to address you have used to register on this forum.
martin

Re: Problem with Daylight saving time

Thanks for your report.

This bug has been added to the tracker:
https://winscp.net/tracker/843
osram

More attachments

More attachments.
Thank you for you help!
osram

Debuginformation

Server time/timezone:
[lujo@oracle ~]$ date

Fri Apr 20 16:20:03 CEST 2012


Server ls:
[lujo@oracle ~]$ sudo ls /home/ftpuser/ -l

total 0
-rw-r--r--. 1 root root 0 Apr 20 15:53 test.test


Code for testclient:
$localDir = ""

$remoteDir = "./"
$remoteUser = "ftpuser"
$remotePassword = "ftp"
$remoteServer = "192.168.10.39"
$remoteKey = "ssh-rsa 2048 9e:8a:5e:3b:e3:85:cd:97:46:5a:1e:53:2c:c0:b2:87"

# Load .NET components
add-type -Path "WinSCP.dll"

try {
    # 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",1)
    $session = New-Object WinSCP.Session
   
   try {
        $session.Open($options)
        $dir = $session.GetFileInfo($remoteDir)
        $ls = $session.ListDirectory($dir)
        write-host "Name `t`t LastWriteTime"
        foreach ($file in $ls.Files) {
            if(!($file.Name -like ".*")){
                $name=$file.Name
                $lastWriteTime=$file.LastWriteTime
                write-host "$name `t $lastWriteTime "
            }
        }
   } finally {
      # Disconnect, clean up
        $session.Dispose()
   }
   
   
} catch {
   write-host -foregroundcolor red "Download failed: $_"
}


WinSCPAssembly - PreserveTime=0, ConsiderDST=0
PS F:\Import> F:\Import\download-test.ps1

Name        LastWriteTime
test.test     04/20/2012 13:53:44


WinSCPAssembly - PreserveTime=1, ConsiderDST=0
PS F:\Import> F:\Import\download-test.ps1

Name        LastWriteTime
test.test     04/20/2012 13:53:44


WinSCPAssembly - PreserveTime=1, ConsiderDST=1
PS F:\Import> F:\Import\download-test.ps1

Name        LastWriteTime
test.test     04/20/2012 14:53:44


xml.log
<?xml version="1.0" encoding="UTF-8"?>

<session xmlns="http://winscp.net/schema/session/1.0" name="ftpuser" start="2012-04-20T13:31:39.844Z">
  <ls>
    <destination value="/home/ftpuser" />
    <files>
      <file>
        <filename value=".bashrc" />
        <type value="-" />
        <size value="124" />
        <modification value="2011-12-02T13:27:20.000Z" />
        <permissions value="rw-r--r--" />
      </file>
      <file>
        <filename value=".." />
        <type value="d" />
        <modification value="2012-04-18T10:27:50.000Z" />
        <permissions value="rwxr-xr-x" />
      </file>
      <file>
        <filename value=".viminfo" />
        <type value="-" />
        <size value="1056" />
        <modification value="2012-04-16T10:21:13.000Z" />
        <permissions value="rw-------" />
      </file>
      <file>
        <filename value="." />
        <type value="d" />
        <modification value="2012-04-20T12:53:44.000Z" />
        <permissions value="rwx------" />
      </file>
      <file>
        <filename value="test.test" />
        <type value="-" />
        <size value="0" />
        <modification value="2012-04-20T12:53:44.000Z" />
        <permissions value="rw-r--r--" />
      </file>
      <file>
        <filename value=".bash_profile" />
        <type value="-" />
        <size value="176" />
        <modification value="2011-12-02T13:27:20.000Z" />
        <permissions value="rw-r--r--" />
      </file>
      <file>
        <filename value=".bash_history" />
        <type value="-" />
        <size value="1429" />
        <modification value="2012-04-20T12:47:22.000Z" />
        <permissions value="rw-------" />
      </file>
      <file>
        <filename value=".bash_logout" />
        <type value="-" />
        <size value="18" />
        <modification value="2011-12-02T13:27:20.000Z" />
        <permissions value="rw-r--r--" />
      </file>
    </files>
    <result success="true" />
  </ls>
</session>
martin

Re: Problem with Daylight saving time

1) What DST setting are you using in the GUI?
2) Please post a screenshot of GUI with some test directory as evidence of correct timestamps
3) Run
winscp.com /xmllog=log.xml /command "open <your session>" "ls <test path>" exit
4) Post log.xml
Thanks
osram

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.
    # 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)
         ....
    }

I've also tested:
    #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"

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