方法一
time_t seconds;seconds = time((time_t *)NULL);/获取秒打印seconds如下11045564071104556408110455640911045564101104556411
方法二:
time_t now;struct tm *tm_now;time(&now);tm_now = localtime(&now);
tm的范围就是0~60。
方法三打印当前时间
time_t t;
struct tm *p;
t=time(NULL);
p=localtime(&t);
printf("%s\n", asctime(p));
方法四:
struct timeval tv;
gettimeofday(&tv, NULL);
printf("tv_sec: %d\n", tv.tv_sec);
printf("tv_usec: %d\n", tv.tv_usec);
