两种不同的时间类型
- time_t 从1970年1月1日到现在经过的秒数;
- struct tm 分别存储表示时间的各字段的值
得到现在的时间(time_t):
- time()
time_t和struct tm之间的相互转换:
- time_t -> struct tm (local):localtime()
- time_t -> struct tm (UTC): gmtime()
- struct tm -> time_t: mktime()
时间类型和字符串之间的相互转换:
- time_t -> string: ctime()
- struct tm -> string: asctime(), strftime()
精确到毫秒的系统时间struct _timeb:
- ftime()
- 其中包含time和millitm
直接得到time和date的string形式:
- strtime()
- strdate()