Topic "Timestamp of files shifts forward 1 hour on download."

Author Message
samk3nny
[View user's profile]
Donor
Joined: 2013-06-18
Posts: 4
Location: New York
The problem I am encountering is that when downloading files from a remote server (this happens with different, independent SFTP sites) the timestamp of the files increases by +1 hour.

This issue only happens when running C# code on our servers using the WINSCP .NET library. Running in debug on local PCs work fine. Using the WINSCP GUI on the servers and on PCs the problem does not occur either.

The PCs are running Windows 7 and the server is Windows 2008R2. I am using version 5.1.5.
The code calls session.GetFiles(). If I explicitly create a TransferOptions object and set PreserveTimestamp = true the timestamp is still increased.

Our servers are based in New York - and I believe the servers we are connecting to are as well.

I have looked through related posts on the forums and elsewhere but could not find any fixes/suggestions. Any ideas at all?

Děkuji,
Sam
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Can you be more specific about what "timestamp of the files increases by +1 hour" means? What files? Local files after download compared against the remote files? Can you give a specific example? Like attaching a screenshot of both WinSCP file panels after the transfer in GUI and than the same after transfer using .NET assembly?
_________________
Martin Prikryl
samk3nny
[View user's profile]
Donor
Joined: 2013-06-18
Posts: 4
Location: New York
Thanks for getting back to me.

Our servers/workstations are in EST. The remote server is CMT (i.e. 1 hour behind EST). On our server the WinSCP GUI should the time of the file on the remote server to be one hour ahead. My workstation shows the correct time.

If I change the DST settings in Environment in the WinSCP GUI on our server, the time on the remote server displays correctly. But in the code, the file is always downloaded with the time being 1 hour ahead.

I have attached 2 screenshots. One from our server showing the WinSCP GUI and in the background the file downloaded from the code. And the second screenshot shows my workstation and WinSCP and the correct time.

Perhaps the solution is simply to set PreserveTimestamp withing TransferOptions to false. I'll try that.
ambre-workstation-cme-remote-correct.jpg (185.55 KB) [Download]

Description: (none)

ambre-server-cme-remote-1hr-ahead.jpg (259.82 KB) [Download]

Description: (none)

samk3nny
[View user's profile]
Donor
Joined: 2013-06-18
Posts: 4
Location: New York
Actually setting PreserveTimestamp to false changes the date/time to that of the download, which I don't want. Is there a way in the code to set the same DST setting that is under Environment in the WinSCP GUI?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Is your remote server a Windows machine? It would make sense to change to DST settings then. Otherwise it's rather a hack that might break once DST is over.

Anyway to change the DST settings for .NET see:
https://winscp.net/eng/docs/rawsettings
_________________
Martin Prikryl
samk3nny
[View user's profile]
Donor
Joined: 2013-06-18
Posts: 4
Location: New York
Děkuji Martin.
The server is Windows 2008R2. Changing the ConsiderDST flag in AddRawSettings() to 2 seems to have done the trick.

Will see if the timestamp changes once DST is over in November! Wink
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License