C语言获取当前时间 单位秒
可以使用time函数获取当前时间,返回值为从1970年1月1日0时0分0秒到当前时间的秒数。
示例代码:
#include <stdio.h>
#include <time.h>
int main()
{
time_t now = time(NULL);
printf("当前时间为:%ld 秒\n", now);
return 0;
}
原文地址: https://www.cveoy.top/t/topic/b2Ab 著作权归作者所有。请勿转载和采集!