gettimeofday
头文件
#include<sys/time.h> #include<unistd.h>
函数原型
int gettimeofday(struct timeval *tv,struct timezone *tz);
函数功能
gettimeofday会把时间返回到tv所指的结构体中,将时区信息返回到tz所指的结构体中
返回值
成功返回0 失败返回-1
两个参数tv和tz都可以为空,若为空,不返回其对应的结构体
两个结构体:
gettimeofday
头文件
#include<sys/time.h> #include<unistd.h>
函数原型
int gettimeofday(struct timeval *tv,struct timezone *tz);
函数功能
gettimeofday会把时间返回到tv所指的结构体中,将时区信息返回到tz所指的结构体中
返回值
成功返回0 失败返回-1
两个参数tv和tz都可以为空,若为空,不返回其对应的结构体
两个结构体: