複製鏈接
請複製以下鏈接發送給好友

SYSTEMTIME

鎖定
在Win32程序彙編中有SYSTEMTIME類數據結構。
外文名
SYSTEMTIME
含    義
SYSTEMTIME類數據結構
平    台
Win32
類    型
軟件開發

目錄

SYSTEMTIME函數

SYSTEMTIME結構定義如下:
SYSTEMTIME STRUCT
WORD wYear ; 年
WORD wMonth ;月
WORD wDayOfWeek ;星期,0=星期日,1=星期一...
WORD wDay ;日
WORD wHour ;時
WORD wMinute ;分
WORD wSecond ;秒
WORD wMilliseconds ;毫秒
SYSTEMTIME ENDS
結構中的字段全為word類型,而Win32程序中用的往往是dword型變量,所以在使用這些數據之前往往要先把它們轉換為dword類型,用movzx指令就可以實現。
在SYSTEMTIME數據結構裏,日期和時間都被編碼了.月份是從1月開始的(一月份就是1月)。週日是從0開始的(星期天是0).wDay是在當前月份下的日期,也是從1開始的。
與獲取系統時間的函數相對應,可以用下面的兩個函數設置系統時間:
invoke SetLocalTime,lpSystemTime,GetLocalTime獲取本地時間
invoke SetSystemTime,lpSystemTime;獲取格林威治標準時間
參考資料:《Windows環境下32位彙編語言程序設計》

SYSTEMTIME解釋

Converts a file time to system time format. System time is based on Coordinated Universal Time (UTC).
Syntax
BOOL WINAPI FileTimeToSystemTime( __in const FILETIME *lpFileTime, __out LPSYSTEMTIME lpSystemTime);
Parameters
lpFileTime [in]A pointer to a FILETIME structure containing the file time to be converted to system (UTC) date and time format. This value must be less than 0. Otherwise, the function fails. lpSystemTime [out]A pointer to a SYSTEMTIME structure to receive the converted file 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.
Requirements

Windows 2000 Professional

Windows 2000 Server

Winbase.h (include Windows.h)

Kernel32.lib

Kernel32.dll