C语言中的time()函数返回的是从1970年1月1日0时0分0秒开始计时的秒数,可以通过ctime()函数将其转换为可读的时间格式。具体步骤如下:
time_t rawtime;
time(&rawtime);
printf("Current time is: %s", ctime(&rawtime));
通过以上步骤,即可将time()函数返回的时间秒数转换为可读的格式输出到控制台。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>