#include <sys/time.h>int gettimeofday(struct timeval *tv, struct timezone *tz);int settimeofday(const struct timeval *tv, const struct timezone *tz);
#include <sys/time.h>
int gettimeofday(struct timeval *tv, struct timezone *tz);
int settimeofday(const struct timeval *tv, const struct timezone *tz);
struct timeval{ long tv_sec;/*秒数*/ long tv_usec;/*微秒数*/};
struct timeval
{
long tv_sec;/*秒数*/
long tv_usec;/*微秒数*/
};
当前时间会返回给这个结构体指针tv。
可以设为NULL。