1 回答

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超6個(gè)贊
GetSystemTime
1、GetSystemTime -
VB聲明
Declare Sub GetSYSTEMTIME Lib "kernel32" Alias "GetSystemTime" (lpSystemTime As SYSTEMTIME)
說(shuō)明:在一個(gè)SYSTEMTIME中載入當(dāng)前系統(tǒng)時(shí)間,這個(gè)時(shí)間采用的是“協(xié)同世界時(shí)間”(即UTC,也叫做GMT)格式
參數(shù) 類(lèi)型及說(shuō)明:lpSystemTime SYSTEMTIME,隨同當(dāng)前時(shí)間載入的結(jié)構(gòu)
2、Ada聲明
type WORD is mod 2**16;
-- SYSTEMTIME 結(jié)構(gòu)
type SYSTEMTIME is record
year : word; -- 年
month : word; -- 月
dayofweek : word; -- 星期,0=星期日,1=星期一
day : word; -- 天
hour : word; -- 時(shí)
minute : word; -- 分
second : word; -- 秒
Milliseconds : word; -- 毫秒
end record;
type LPSYSTEMTIME is access SYSTEMTIME;
procedure GetSystemTime(SYSTIME:LPSYSTEMTIME);
function GetSystemTime(SYSTIME:LPSYSTEMTIME) return integer;
pragma import(stdcall,GetSystemTime,"GetSystemTime");
3、注意:
(1)參數(shù)SYSTIME必須首先分配內(nèi)存空間,否則引起PROGRAM_ERROR 。
(2)該函數(shù)獲取格林威治標(biāo)準(zhǔn)時(shí)間。
4、范例:
CTime time = CTime::GetCurrentTime(); ///構(gòu)造CTime對(duì)象
int m_nYear = time.GetYear(); ///年
int m_nMonth = time.GetMonth(); ///月
int m_nDay = time.GetDay(); ///日
int m_nHour = time.GetHour(); ///小時(shí)
int m_nMinute = time.GetMinute(); ///分鐘
int m_nSecond = time.GetSecond(); ///秒
- 1 回答
- 0 關(guān)注
- 713 瀏覽
添加回答
舉報(bào)