我正在编写一个 C 程序,使用 nftw()
来遍历文件系统并检索每个文件的文件修改时间。
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?
最佳答案
通常,其中一个手册页描述了这些结构包含的内容。如果您告诉我们您的平台,我可以提供更多详细信息。否则,打开头文件 /usr/include/time.h
以查看 struct timespec
的定义。
关于c - 如何查找struct timespec的开发信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34900056/