Post a reply :: Support Forum

Tip: Styles can be applied quickly to selected text.

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

samk3nny

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:
martin

Re: Timestamp of files shifts forward 1 hour on download

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
samk3nny

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?
samk3nny

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.
martin

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?
samk3nny

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