From MSDN docs:
The FILETIME data structure is a 64-bit value representing the number of 100-nanosecond intervals
since January 1, 1601. It is the means by which Win32 determines the date and time.
typedef struct STRUCT tagFILETIME
{
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
In ot4xb the FILETIME class not only implement the WinAPI FILETIME structure but also extend it
with some extra utility methods and properties implemented as ACCESS ASSIGN Xbase++ METHODS.
The ot4xb FILETIME class will look like:
CLASS FILETIME FROM GWST
EXPORTED:
PROPERTY dwLowDateTime // 32 bit integer containing the low part
// of the win32 datetime value.
PROPERTY dwHighDateTime // 32 bit integer containing the high part
// of the win32 datetime value.
PROPERTY qft // 64bit integer containing the win32 datetime value
METHOD GetTimeStamp14() // -> "YYYYMMDDHHMMSS"
METHOD GetTimeStamp19() // return a "YYYY-MM-DD HH:MM:SS"
METHOD GetTimeStamp() // same as GetTimeStamp19()
METHOD SetTimeStamp( cTimeStr ) // Accept either a 14 or 19 bytes
// string ( see explanation on ::cTimeStamp assign )
PROPERTY cTimeStamp
On access return always a 14byte "YYYYMMDDHHMMSS" string
On assign accept either a 14 or 19 byte string like the
::SetTimeStamp() method so the following expressions
are valid and equivalent
oFt:cTimeStamp := "20080913171000"
oFt:cTimeStamp := "2008-09-13 17:10:00"
Milliseconds are optional so this expressions will be
also valid and equivalents
oFt:cTimeStamp := "20080913171000.000"
oFt:cTimeStamp := "20080913171000000"
oFt:cTimeStamp := "2008-09-13 17:10:00.000"
If the time part of the expression is omitted 00:00:00 is assumed
oFt:cTimeStamp := "20080913"
oFt:cTimeStamp := "2008-09-13"
.... will be equivalent to
oFt:cTimeStamp := "20080913000000"
This property can be useful to handle FOXDBE "T" date-time fields
METHOD _GetTimeStamp_( cFmtStr )
Format the timestamp using a cPrinf() like template
by example ::GetTimeStamp14() is defined as:
return ::_GetTimeStamp_('%04.4hu%02.2hu%02.2hu%02.2hu%02.2hu%02.2hu')
parameters are int32 holding: year,month,day,hour,minute,second,milliseconds
-------------
ot4xb build 1,5,2,88 ADD-ON: wsprintf() replaced with _sprintf_p()
so since this build positional format parameters are also accepted.
See _sprintf_p() in MSDN docs for more info.
METHOD SetDateTime( dDate , cnTime )
// Set date/time using the standard Xbase++ Date() , Time() format
// if cnTime is numeric will interpreted as seconds since midnight.
METHOD GetDateTime( @dDate , @cTime )
// Set date/time using the standard Xbase++ Date() , Time() format
METHOD GetDateTimeSec( @dDate , @nTime )
// Like ::GetDateTime() but with time as seconds since midnight.
METHOD Now()
// Store the current GTM timestamp. Return Self
-------------
ot4xb build 1,5,2,88 ADD-ON:
Added optional param lLocalTime ( .F. by default)
to store local time instead of universal time.
METHOD EllapSeconds( ft ) -> nSeconds elapsed betwen Self and <ft>
METHOD EllapMilliSeconds( ft ) -> nMilliSeconds elapsed between
Self and <ft>
<ft> can be a FILETIME object or also a 64 bit integer
PROPERTY dDate
// store or retrieve the date component using a Xbase++ date value
PROPERTY cTime
// store or retrieve the time component using the format
HH:MM:SS.mmm ( mmm milliseconds)
PROPERTY cHexTs
// Store or retrieve the datetime value as hexadecimal string
representing a 64bit integer ( 16 chars)
METHOD SetHexTs( cHexTs )
METHOD GetHexTs() -> cHexTs
PROPERTY nDosDateTime
// store or retrieve the datetime value as
DOS datetime integer value
ENDCLASS
As the ot4xb FILETIME class is also a GWST structure with a size of 8 bytes can be used like a regular child member of any GWST structure.
Also can be provided as int64 or FILETIME* parameter when calling a DLL IMPORT ot4xb function