我正在编写一个使用nftw()
的C程序来遍历文件系统并检索每个文件的文件修改时间。如何找到struct timespec的开发信息
nftw()
调用提供的函数指针并提供一个作为参数的struct stat
。
man stat(2)
指出,修改时间的字段有:
struct timespec st_atim; /* time of last access */
struct timespec st_mtim; /* time of last modification */
struct timespec st_ctim; /* time of last status change */
然而,尽管man stat(2)
提供了如何打印时间区域的例子,它并没有告诉我如何找到有关struct timespec
,也没怎么查询/操作时间修改字段。
我应该如何在没有诉诸Google的情况下单独在我的电脑上查找信息?
我正在运行Ubuntu 15.10 64bit。 – retrodev
我猜你知道要从经验中打开time.h。手册页不会引用该标题。我怎么能自己得出这个结论? – retrodev
@retrodev [POSIX指定](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html)这是声明'struct timespec'的地方。 – fuz