| Main index | Section 3 | Options |
#include <sys/time.h>
struct timeval {
long tv_sec; /* seconds since Jan. 1, 1970 */
long tv_usec; /* and microseconds */
};
And the timespec structure is defined in <time.h> as:
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
};
timeradd() and timespecadd() add the time information stored in a to b and store the result in res. The results are simplified such that the value of res->tv_usec or res->tv_nsec is always less than 1 second.
timersub() and timespecsub() subtract the time information stored in b from a and store the result in res.
timerclear() and timespecclear() initialize their argument to midnight (0 hour) January 1st, 1970 (the Epoch).
timerisset() and timespecisset() return true if their argument is set to any time value other than the Epoch.
timercmp() and timespeccmp() compare a to b using the comparison operator given in CMP, and return the result of that comparison.
| TIMERADD (3) | July 30, 2018 |
| Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | This philosophy, in the hands of amateurs, leads to inexplicably mind-numbing botches like the existence of two programs, “head” and “tail,” which print the first part or the last part of a file, depending. Even though their operations are duals of one another, “head” and “tail” are different programs, written by different authors, and take different options! | ” |
| — The Unix Haters' handbook | ||