linux C打印时间

1.输出unix时间戳,和本地时间 

#include<time.h>
#include<stdio.h>    
  
void main()   
{   
time_t now;     
struct tm *timenow;     
time(&now);   //获取unix时间戳
printf("now:%llu\n",now);  
  
timenow = localtime(&now);   //将unix时间戳,转化为本地时间    
  
printf("Local time is %s/n",asctime(timenow));   //asctime函数把时间转换成字符,通过printf()函数输出    
}   

 

linux C打印时间

上一篇:Mac 添加admin 权限


下一篇:Linux下安装redis常见错误server.c:3318:16: error: ‘struct redisServer‘ has no member named ‘loading‘