I'm writing a C program using nftw()
to walk a filesystem and retrieve file modification times for each file.
nftw()
calls a supplied function pointer and provides a struct stat
as an argument.
man stat(2)
states that the time modification fields are:
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 */
However, whilst man stat(2)
provides an example of how to print the time fields, it doesn't tell me how to find information about struct timespec
, nor how to query/manipulate the time modification fields.
How should I go about finding that information on my computer alone, without resorting to Google?
Typically one of the man pages describes what these structures contain. If you tell us your platform I can give further details. Otherwise, open up the header /usr/include/time.h
to see what struct timespec
is defined as.