login about faq

I am trying to use get_CreateTime but it wants sysTime.

I have been to http://www.chilkatsoft.com/refdoc/phpCkSFtpFileRef.html but I do not understand this line // sysTime is a SYSTEMTIME object (output)

What does the sysTime represent and how do I use it to get the Create Time of a file

asked Aug 22 '12 at 10:16

kevindcs's gravatar image

kevindcs
11556


The SYSTEMTIME structure is something from the MS Windows history of Chilkat. About 10 years ago, Chilkat began as a component vendor for C++ libs and ActiveX components specific to the Windows platform. This is where the use of the SYSTEMTIME structure originated.

The SYSTEMTIME structure is defined (in C++ syntax) as follows:

struct SYSTEMTIME {
    unsigned short wYear;
    unsigned short  wMonth;
    unsigned short  wDayOfWeek;
    unsigned short  wDay;
    unsigned short  wHour;
    unsigned short  wMinute;
    unsigned short  wSecond;
    unsigned short  wMilliseconds;
};

In PHP, you would access it like this:

<?php

include("chilkat_9_3_2.php");

$sftpFile = new CkSFtpFile();

$sysTime = new SYSTEMTIME();

$sftpFile->get_CreateTime($sysTime);

print $sysTime->wHour . ":" . $sysTime->wMinute . "\n";

?>

Some important notes:

  1. Notice that you must create an instance of SYSTEMTIME and pass it to get_CreateTime. The get_CreateTime method sets the data members of the SYSTEMTIME structure.
  2. In this example, we're instantiating a new (and empty) instance of CkSFtpFile. Normally you would never do this -- a CkSFtpFile object instance is normally returned via the GetFileObject method of the CkSFtpDir class.
  3. On Linux and other Unix-type systems, the filesystem does not store creation times. (Windows filesystems do store create times.) Therefore, the "create" time for a file on a non-Windows system will be the same as the last-modified time.
  4. The SYSTEMTIME structure lacks information about timezone, and this is bad.
  5. To address the inadequacies of SYSTEMTIME, Chilkat introduced the CkDateTime class in v9.3.1. You'll find alternative methods for getting date/time values as a CkDateTime object ( see http://www.chilkatsoft.com/refdoc/phpCkDateTimeRef.html ) The new methods returning a CkDateTime will have names ending in "Dt". For example: GetCreateDt()
  6. I see that the online reference documentation is not updated for most of the "Dt" methods. I will address this very soon (maybe even today).
  7. The CkDateTime class has methods for getting the date/time in several different formats, some of which may be useful in your native programming language.
  8. There is also a CkDtObj that provides access to the integer values for year, month, day, hour, minute, etc. (See http://www.chilkatsoft.com/refdoc/phpCkDtObjRef.html ) A CkDtObj can be loaded from a CkDateTime as shown below:
$dateTime = new CkDateTime();
$dt = new CkDtObj();

$dt->DeSerialize($dateTime->serialize());
print $dt->get_Hour() . ":" . $dt->get_Minute() . "\n";

Finally, the methods ending in "Dt" return a CkDateTime object (as opposed to the methods where a SYSTEMTIME object is passed in to be populated). For example:

$dateTime = $sftpFile->GetCreateDt();
link

answered Aug 22 '12 at 12:20

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Thank you very much for your answer. I don't have any c++ experience, so your answer was helpful

link

answered Aug 23 '12 at 12:23

kevindcs's gravatar image

kevindcs
11556

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×201
×37
×17
×7

Asked: Aug 22 '12 at 10:16

Seen: 2,926 times

Last updated: Aug 23 '12 at 12:23

powered by OSQA