SystemTimeToFileTime
Jump to navigation
Jump to search
Description
Converts a system time to file time format. System time is based on Coordinated Universal Time (UTC).
Syntax
BOOL WINAPI SystemTimeToFileTime(
_In_ const SYSTEMTIME *lpSystemTime,
_Out_ LPFILETIME lpFileTime
);
Parameters
- lpSystemTime [in]
- A pointer to a SYSTEMTIME structure that contains the system time to be converted from UTC to file time format.
- The wDayOfWeek member of the SYSTEMTIME structure is ignored.
- lpFileTime [out]
- A pointer to a FILETIME structure to receive the converted system time.
Return value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Example
In the below example, all values are first set to 0 (The xor edx,edx instruction will set the EDX register to zero), and then the value for the year is set to 0x0834 at 0x004010DE (2100 in decimal). This time represents midnight on January 1, 2100. The program then calls SystemTimeToFileTime.
.text:004010C2 xor edx, edx
.text:004010C4 lea eax, [esp+404h+FileTime]
.text:004010C8 mov dword ptr [esp+404h+SystemTime.wYear], edx
.text:004010CC lea ecx, [esp+404h+SystemTime]
.text:004010D0 mov dword ptr [esp+404h+SystemTime.wDayOfWeek], edx
.text:004010D4 push eax ; lpFileTime
.text:004010D5 mov dword ptr [esp+408h+SystemTime.wHour], edx
.text:004010D9 push ecx ; lpSystemTime
.text:004010DA mov dword ptr [esp+40Ch+SystemTime.wSecond], edx
.text:004010DE mov [esp+40Ch+SystemTime.wYear], 834h
.text:004010E5 call ds:SystemTimeToFileTime