Subject: timezeone adjustment
Date: 2017-06-09 11:22:13
From: nicolas nicolas
Source: timezeone-adjustment
----------------------------------------------------------------------

hi,

I made a test about file uploading and timezone adjustments

[code lang='c#']

        public static void proc_test()
        {
        Ftp ftp;
        ComponentPro.IO.FileInfoCollection files1;

            ftp = new Ftp();
            ftp.Connect ("theftpcomputer",21);
            ftp.Authenticate("myuser", "mypassword");
            Console.WriteLine ("ServerTimeZoneOffset=" + ftp.ServerTimeZoneOffset );
            Console.WriteLine (" RestoreFileProperties=" + ftp. RestoreFileProperties);
            ftp.Upload (@"D:\temp\dir1\x3.txt", @"/dir1/xx3");
            ftp.SetCurrentDirectory (@"/dir1/xx3");
            files1 = ftp.ListDirectory();

            foreach (FtpFileInfo f in files1)
                {
                if (f.FullName.ToLower().Contains ("x3.txt") == true)
                    Console.WriteLine ("File=" + f.FullName + " CreationTime=" + f.CreationTime + " LastWriteTime=" + f.LastWriteTime + " Size=" + f.Length);
                }
        }

[/code]

the result was run at 14:10 and is the following:

ServerTimeZoneOffset=00:00:00
 RestoreFileProperties=False
File=/dir1/xx3/x3.txt CreationTime=01/01/0001 00:00:00 LastWriteTime=09/06/2017 16:10:27 Size=12

on the ftp server (windows) , when I check the file :

C:\ftp\n\dir1\xx3>dir x3.txt
 Le volume dans le lecteur C s'appelle disk_system
 Le numéro de série du volume est 7471-F7A5

 Répertoire de C:\ftp\n\dir1\xx3

09/06/2017  14:10    <REP>          .
09/06/2017  14:10    <REP>          ..
09/06/2017  14:10                12 x3.txt
               1 fichier(s)               12 octets

the source computer and the ftp server are located in the same area, in the same TZ : UTC+1
why do the listedirectory() command from ftp class made "internally" an adjustement of 2 HOURS while the offset is zero

 

UPDATE:

------------------

I made a new test adding the log file option.  running at 14:53 (UTC+1),

 

again, the list directory() report a delta of 2 hours for the file but the log file report that the ftp server send the correct timestamp

Ftp: 1, Thread Id: 0 [06/09/2017 14:53:05.86] Information - Response: 150 Opening ASCII mode data connection for data transfer
Ftp: 1, Thread Id: 0 [06/09/2017 14:53:05.87] Verbose - Info: Checking incoming data.
Ftp: 1, Thread Id: 0 [06/09/2017 14:53:05.88] Verbose - Info: Received 60 bytes of data through data connection.
Ftp: 1, Thread Id: 0 [06/09/2017 14:53:05.88] Verbose - Info: Found FTP Item: Type=file;Size=12;Modify=20170609145327;Perm=awdfr; x3.txt
Ftp: 1, Thread Id: 0 [06/09/2017 14:53:05.89] Verbose - Info: Checking incoming data.
 

many thanks for your help.

---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index