Sync problem with server that has zero timezone offset
My computer is Windows 7 SP1 in the US Eastern time zone (offset -4), while the remote server is Windows Server 2012 in the Coordinated Universal Time time zone (offset 00:00:00).
I'm using WinSCP version 5.7.5 via the WinSCP Powershell module from https://github.com/tomohulk/WinSCP.
I'm using the Sync-WinSCPPath powershell command to sync two files from my computer to the wwwroot/Uploads folder on the remote server. This is the test powershell script:
Remove-Module [w]inscp
Import-Module WinScp
$ftpHost = "svvs-v-win-stage.corp"
$ftpUser = "user.com-stg"
$ftpDir = "wwwroot/Uploads"
$credential = Get-Credential -UserName $ftpUser -Message "Please enter password for $ftpHost."
$log = (Join-Path $PSScriptRoot "sync-bug.log")
Write-Host "write log to $log"
$session = New-WinSCPSession -Hostname $ftpHost -Credential $credential -Protocol Ftp -SessionLogPath $log
$source = (Join-Path $PSScriptRoot "Uploads")
Write-Host "sync $source to $ftpDir"
Sync-WinSCPPath -WinSCPSession $session -Mode Remote -Criteria Either -LocalPath $source -RemotePath $ftpDir
Remove-WinSCPSession -WinSCPSession $session
These are the steps I took:
1) Run this powershell script to sync local Upload folder containing grog.png file dated 7/28/2014 11:01am.
2) Filezilla GUI shows the remote grog.png file is dated 7/28/2015 11:01am (which is accurate).
3) WinSCP GUI shows the remote grog.png file is dated 7/28/2014 7:01pm (which is 8 hours later).
4) Run the script again and WinSCP doesn't copy any files (i.e. the local grog.png file hasn't changed).
5) I touch the local grog.png file changing its timestamp to 10/6/2015 9:04pm.
6) Run the script again and WinSCP copies the grog.png file to the remote server.
7) Filezilla GUI shows the remote grog.png file is dated 10/6/2015 9:04pm (which is accurate).
8) WinSCP GUI shows the remote grog.png file is dated 10/7/2015 5:04am (which is 8 hours in the future).
9) Touch the local grog.png file again, changing its timestamp to 10/6/2015 9:09pm.
10) Run the script again and WinSCP doesn't copy the grog.png file to the remote server, but it should have.
I've looked over the attached log and I think WinSCP is wrongly calculating the remote file timestamp. Perhaps it is just a coincidence, but WinSCP is off by 8 hours, double the absolute value of the offset my computer has with the US Eastern timezone.
Please let me know if you have any questions or need any additional information.
Thanks
Dan