为了账号安全,请及时绑定邮箱和手机立即绑定

时间的API函数

时间的API函数

API
婷婷同学_ 2018-12-04 09:04:32
时间的API函数
查看完整描述

1 回答

?
哈士奇WWW

TA贡献1799条经验 获得超6个赞

GetSystemTime
1、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 record
year : 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(); ///秒



查看完整回答
反对 回复 2018-12-20
  • 1 回答
  • 0 关注
  • 628 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信