13,825
社区成员
发帖
与我相关
我的任务
分享
类型定义:
1.TDateTime:TDateTime is the C++ analog for the Object Pascal TDateTime data type.
2.typedef _FILETIME TFileTime;
3.typedef _SYSTEMTIME TSystemTime;
解释:
1.
The TDateTime class inherits a val data member declared as a double that holds the date-time value. The integral part of a TDateTime value is the number of days that have passed since 12/30/1899. The fractional part of a TDateTime value is the time of day.
2.
typedef struct _FILETIME {
DWORD dwLowDateTime; /* low 32 bits */
DWORD dwHighDateTime; /* high 32 bits */
} FILETIME, *PFILETIME, *LPFILETIME;
The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601.
3.
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
The SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.
相互转化:
1.
FileTimeToSystemTime
The FileTimeToSystemTime function converts a 64-bit file time to system time format.
BOOL FileTimeToSystemTime(
CONST FILETIME *lpFileTime, // pointer to file time to convert
LPSYSTEMTIME lpSystemTime // pointer to structure to receive
// system time
);
SystemTimeToFileTime
The SystemTimeToFileTime function converts a system time to a file time.
BOOL SystemTimeToFileTime(
CONST SYSTEMTIME *lpSystemTime,
// address of system time to convert
LPFILETIME lpFileTime // address of buffer for converted file
// time
);
2.
DateTimeToSystemTime
Converts a TDateTime object into the Win32 API's _SYSTEMTIME type.
Unit:SysUtils
Category:date/time routines
extern PACKAGE void __fastcall DateTimeToSystemTime(const System::TDateTime DateTime, _SYSTEMTIME &SystemTime);
Description:Use DateTimeToSystemTime to convert a TDateTime object into a _SYSTEMTIME value to use with an API call.
SystemTimeToDateTime
Converts a _SYSTEMTIME value into a TDateTime objectvalue.
Unit:SysUtils
Category:date/time routines
extern PACKAGE System::TDateTime __fastcall SystemTimeToDateTime(const _SYSTEMTIME &SystemTime);
Description:Call SystemTimeToDateTime to convert a value from Windows 32's TSystemTime_SYSTEMTIME API format to a TDateTime objectvalue.