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

c语言获取系统当前时间的函数,求讲解?

c语言获取系统当前时间的函数,求讲解?

慕桂英3389331 2019-02-04 10:06:05
c语言获取系统当前时间的函数,求讲解
查看完整描述

2 回答

?
慕田峪7331174

TA贡献1828条经验 获得超13个赞

time_t是个重定义的长整型结构。
调用time函数获取时间,返回的是一个秒数。
当前时间需要调用localtime进行转换一下。
struct tm {
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [0,59] */
int tm_hour; /* hours since midnight - [0,23] */
int tm_mday; /* day of the month - [1,31] */
int tm_mon; /* months since January - [0,11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday - [0,6] */
int tm_yday; /* days since January 1 - [0,365] */
int tm_isdst; /* daylight savings time flag */
};



查看完整回答
反对 回复 2019-03-22
  • 2 回答
  • 0 关注
  • 638 浏览
慕课专栏
更多

添加回答

举报

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