高级UNIX环境编程2

perror("error:") ; 

strerror

日历时间:time_t (1970.1.1开始的秒数)     struct timeval (秒数和微秒)  struct tm

struct  t m * localtime(const time_t *t);  === time_t mktime(struct ™ *tmbuf);

struct t m* gmtime( const time_t *t );//to utc时间

char * ctime( const time_t *t);

char * asctime(const struct  t m* tmbuf);

size_t strftime(char *buf,/*output buffer*/

                         size_t bufsize,const char* format ,const struct  t m * tmbuf)

struct t m * getdate (const char*s)

double difftime(time_t time1,time_t time0);

两次调用gettimeofday,然后对tv_sec字段使用difftime,对tv_usec使用减法 取的时间差

三个函数测时间间隔:gettimeofday,clock,

clock_t times( struct tms *buffer);

原文地址:https://www.cnblogs.com/anjsoft/p/3265491.html