Timestamp of files shifts forward 1 hour on download.

Advertisement

samk3nny
Donor
Joined:
Posts:
4
Location:
New York

Timestamp of files shifts forward 1 hour on download.

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

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Timestamp of files shifts forward 1 hour on download.

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?

Reply with quote

samk3nny
Donor
Joined:
Posts:
4
Location:
New York

Re: Timestamp of files shifts forward 1 hour on download

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

ambre-server-cme-remote-1hr-ahead.jpg

Reply with quote E-mail

samk3nny
Donor

Re: Timestamp of files shifts forward 1 hour on download

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?

Reply with quote E-mail

Advertisement

samk3nny
Donor
Joined:
Posts:
4
Location:
New York

Re: Timestamp of files shifts forward 1 hour on download.

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:

Reply with quote E-mail

Advertisement

You can post new topics in this forum