我目前正在使用显式强制转换unsigned long long并使用%llu它来打印它,但既然size_t有说明%z符,为什么没有clock_t?
甚至没有宏观.也许我可以假设在x64系统(操作系统和CPU)size_t上长度为8个字节(即使在这种情况下,他们已提供%z),但是呢clock_t?
程序:
#include<stdio.h>
#include<fcntl.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<unistd.h>
void main()
{
struct stat stbuf;
stat("alphabet",&stbuf);
printf("Access time = %d\n",stbuf.st_atime);
printf("Modification time = %d\n",stbuf.st_mtime);
printf("Change time = %d\n",stbuf.st_mtime);
}
Run Code Online (Sandbox Code Playgroud)
上面的程序给出了以下输出:
输出:
$ ./a.out
Access time = 1441619019
Modification time = 1441618853
Change time = 1441618853
$
Run Code Online (Sandbox Code Playgroud)
它以秒为单位打印日期.在C中,将时间打印为由stat函数返回的人类可读格式的方法是什么.返回类型stbuf.st_atime是__time_t.
提前致谢...