GUI ScreenIO for Windows

 ScreenIO.com


GetFileTime

The GetFileTime API retrieves the time a file or directory was created, last accessed, and last modified.  The Windows API supplies the dates in FILETIME format, a 64-bit number which is the number of 100 nanosecond intervals since 12:00 A.M. January 1, 1601.  The FAT file system stores times based on the local time of the computer.  NTFS file systems use Coordinated Universal Time (UTC).  

This implementation of the API provides both the raw FILETIME format of the date, and a more usable format that has year, month, day-of-week, day, hour, minute, second, and millisecond.

Client/Server issues

The API may be used to access files on either the client or the server.  To interrogate a file on the server:

     SET WIN32API-EXECUTE-API-ON-SERVER TO TRUE

Files

Files available to copy to your system:

Usage

     COPY WIN32API.
     COPY GETFTIME.

* ------------------------: Call the API.

     SET API-GETFILETIME TO TRUE.

     CALL 'GSWINAPI' USING WIN32API-PARMS
                           FT-FILESPEC
                           FT-CREATE-TIME
                           FT-LAST-ACCESS-TIME
                           FT-LAST-WRITE-TIME
                           WIN32API-E
                           WIN32API-F.

Parameters specific to this function

FT-FILESPEC

Pathspec of file (up to 1024 bytes).

FT-CREATE-TIME

Time the file was created.

FT-LAST-ACCESS-TIME

Time the file was last accessed.

FT-LAST-WRITE-TIME.

Time the file was last modified.

For each of these Times, the following subfieds are defined.

YEAR
MONTH
DAY-OF-WEEK
DAY
HOUR
MINUTE
SECOND
MILLISECOND

 

Note: File times are not guaranteed to be precise.  According to Microsoft's documentation: 

"Timestamps are updated at various times and for various reasons. The only guarantee about a file timestamp is that the file time is correctly reflected when the handle that makes the change is closed.

"Not all file systems can record creation and last access times, and not all file systems record them in the same manner. For example, the resolution of create time on FAT is 10 milliseconds, while write time has a resolution of 2 seconds and access time has a resolution of 1 day, so it is really the access date. The NTFS file system delays updates to the last access time for a file by up to 1 hour after the last access."
Also be aware that last access time may be set by virus scanners, backup software, or anything that reads the file.

Because of this, Last Modified time should be used for most purposes.

All times are Coordinated Universal Time (UTC).  You can get the computer's time in this same format with our GetSystemTime API.

WIN32API-PARMS - Used in all GSWINAPI calls

This argument is standard for all CALLs to GSWINAPI. It is used to select the desired API or function, and to return the status of the operation.

WIN32API-RC

Used to return the status of a call to GSWINAPI.  A value of zero is a failure, any other value indicates success.

Recommended usage is to test the 88-level value WIN32API to see if it worked, then to use the text error message to see why it failed.

* ------------------------: If function failed,
*                         :   display the error in a message box.
*
     IF WIN32API-FAILED
       MOVE WIN32API-ERROR-TEXT TO panel-MESSAGE-TEXT
       SET panel-MESSAGE-IN-MESSAGEBOX TO TRUE.

WIN32API-ERROR-CODE

Error code that was returned by Windows.  This is not generally useful unless you have the Windows Platform SDK documentation available to you.

WIN32API-ERROR-TEXT

Plain-text error message that describes why the operation failed.

WIN32API-A through WIN32API-F

The number of these present varies depending on how many arguments are used by the desired function.  These are not used, but must be present because this CALL requires seven arguments.


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom