时间的API函数

时间的API函数


婷婷同学_
浏览 631回答 1
1回答

哈士奇WWW

GetSystemTime1、GetSystemTime -VB声明Declare Sub GetSYSTEMTIME Lib "kernel32" Alias "GetSystemTime" (lpSystemTime As SYSTEMTIME)说明:在一个SYSTEMTIME中载入当前系统时间,这个时间采用的是“协同世界时间”(即UTC,也叫做GMT)格式参数 类型及说明:lpSystemTime SYSTEMTIME,随同当前时间载入的结构2、Ada声明type WORD is mod 2**16;-- SYSTEMTIME 结构type SYSTEMTIME is recordyear : word; -- 年month : word; -- 月dayofweek : word; -- 星期,0=星期日,1=星期一day : word; -- 天hour : word; -- 时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)参数SYSTIME必须首先分配内存空间,否则引起PROGRAM_ERROR 。(2)该函数获取格林威治标准时间。4、范例:CTime time = CTime::GetCurrentTime(); ///构造CTime对象int m_nYear = time.GetYear(); ///年int m_nMonth = time.GetMonth(); ///月int m_nDay = time.GetDay(); ///日int m_nHour = time.GetHour(); ///小时int m_nMinute = time.GetMinute(); ///分钟int m_nSecond = time.GetSecond(); ///秒
打开App,查看更多内容
随时随地看视频慕课网APP