Linux下日历时间相关的类型有:
time_t //算术类型
struct tm //分散时间结构
struct timeval //gettimeofday的结构
跟时间转换和计算相关的函数 (只写函数名,不是完整的原型。注释说明的是来自哪个头文件,以及相应的作用。下同):
time //<time.h> , get time_t
gettimeofday //<sys/time.h> , get timeval
localtime //<time.h> , time_t --> tm
gmtime //<time.h> , time_t --> tm
mktime //<time.h> , tm --> time_t
ctime //<time.h> , time_t --> string
astime //<time.h> , tm --> string
strftime //<time.h> , tm --> format string
wcsftime //<wchar.h> , tm --> format string
getdate //<time.h> , string --> tm
strptime //<time.h> , string --> tm
difftime //<time.h> , 计算time_t之差
tzset //<time.h> , 设置时区
与程序执行时间相关的类型:
clock_t //以CLOCKS_PER_SEC或时钟滴答为单位
struct timeval
struct timespec //<time.h>
测量时间间隔的函数:
clock //<time.h> , 得到执行时间
times //<sys/times.h> , 得到进程和子进程的执行时间
文档信息
- 版权声明:自由转载-非商用-非衍生-保持署名 | Creative Commons BY-NC-ND 3.0
- 原文出处:三生石的博客
没有评论:
发表评论