18.1 File access time
If times is a null pointer, both the access time and the modification time are set to the current time;
If times is a non-null pointer, the access time and modification time are set to the values in the structure pointed to by times. At this point, the effective user ID of the process must be equal to the owner ID of the file, or the process must be a superuser process. Only having write permission on a file is not enough
The structure used by this function is:
18.2 CPU usage time
#include <sys/types.h>
#include <utime.h>
int utime (const char *name, const struct utimebuf *t); return: 0 if successful, -1 if error
struct utimbuf {
time_t actime; /*access time*/ time_t modtime; /*modification time*/ }
#include <sys/time.h> #include <sys/resource.h>
int getrusage(int who, struct rusage *usage);
RUSAGE_SELF
Return resource usage statistics for the calling process, which is the sum of resources used by all threads in the process.
218 Chapter 18 Time Functions
RUSAGE_CHILDREN
Return resource usage statistics for all children of the calling process that have terminated and been waited for. These statis‐ tics will include the resources used by grandchildren, and fur‐ ther removed descendants, if all of the intervening descendants waited on their terminated children.
RUSAGE_THREAD (since Linux 2.6.26)
Return resource usage statistics for the calling thread.