File Sync Daylight Savings Issue

Advertisement

ekirkco
Guest

File Sync Daylight Savings Issue

I recently set up a sync using the .Net libraries. I'm syncing from/to Windows Server 2008r2. Both are set to US Central Time with Daylight Savings enabled. I'm using Bitvise SSH Server, (winsshd), on the remote server. The sync works fine, but for some reason the modified stamps are an hour earlier on the remote server. I tried opening WinSCP, setting it to "adjust remote timestamp with DST" and saving as default which updated my .ini file. I also tried sessionOptions.AddRawSettings("ConsiderDST","1") in my .Net code.(found this google hit: <invalid link removed by admin>) To test these, I deleted a file from the remote server and ran the sync. In both cases the file I deleted was recreated with a modified date that was still off by an hour. Any ideas what would be going on here? From the documentation it seems like 2008r2 shouldn't be affected, but it's hard to tell. Here's the code if it helps:

SessionOptions sessionOptions = new SessionOptions
{
    Protocol = Protocol.Sftp,
    HostName = context.MergedJobDataMap.GetString("HostName"),
    PortNumber = context.MergedJobDataMap.GetInt("PortNumber"),
    UserName = context.MergedJobDataMap.GetString("UserName"),
    //Password = context.MergedJobDataMap.GetString("Password"),
    SshPrivateKeyPath = context.MergedJobDataMap.GetString("PrivateKeyPath"),
    SshHostKeyFingerprint = context.MergedJobDataMap.GetString("SshHostKeyFingerprint")
};

using (Session session = new Session())
{
    // Will continuously report progress of synchronization
    session.FileTransferred += delegate(object sender, TransferEventArgs e){
        if(e.Removal != null && e.Removal.FileName != null)
        {
            Log.Info("Removing file: "+e.Removal.FileName);
        }
        Log.Info("File transferred: "+e.FileName);
    };

    session.Open(sessionOptions);

    SynchronizationResult synchronizationResult;
    synchronizationResult =
        session.SynchronizeDirectories(
            (SynchronizationMode)Enum.Parse(typeof(SynchronizationMode), context.MergedJobDataMap.GetString("SynchronizationMode")),
            context.MergedJobDataMap.GetString("LocalDirectory"), 
            context.MergedJobDataMap.GetString("RemoteDirectory"),
            context.MergedJobDataMap.GetBoolean("DeleteFiles"));

    // Throw exception on any error
    synchronizationResult.Check();
}


Thanks,
--Evan[/code]

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,430
Location:
Prague, Czechia

Re: File Sync Daylight Savings Issue

Where do you observe a shifted timestamp? In WinSCP listing on remote panel? In Windows Explorer? Or both? Please attach a full log file showing upload of a single file. Please indicate timestamp you expect the file should have a timestamp you actually see.

Reply with quote

Advertisement

You can post new topics in this forum