#include<time.h>
time_t time(time_t *t);
函数返回值为从1970年起到现在的时间而用秒来计算的。失败则返回-1;
#include<time.h>
#include<unistd.h>
int gettimeofday(struct timeval *tv,struct timezone *tz);
double difftime(time_t time1,time_t time2);
二、日历时间。把系统时间转变为日历时间
#include<time.h>
struct tm* gmtime(const time_t *calptr);
struct tm *locatime(const time_t *calptr);
返回值为tm的一个结构体。
把日历时间转为系统时间
time_t mktime(strcut tm * tmptr);
为了更加让人看起来好看点还有asctime ctime 将time_t和tm类型的时间值转换字符串。
char *asctime(const struct tm* tmptr);
char ctime(const time_t *calptr);