difftime -- Compute the Difference of Two Times

SYNOPSIS
#include <time.h>
double difftime(time_t time2, time_t time1);
DESCRIPTION
difftime
computes the difference time2 - time1
in seconds,
where time2
and time1
are values of type time_t
(such as
those returned by the time
function).
RETURN VALUE
difftime
returns the difference between the two times in seconds.
CAUTION
difftime
is implemented as a macro. If its arguments are not of
type time_t
, the results are not meaningful.
EXAMPLE
#include <time.h>
#include <stdio.h>
main()
{
double x;
time_t last_written; /* time data last written */
/* time(&last_written); */
/* if data are more than 1 week old */
if ((x = difftime(time(NULL), last_written)) > 7 * 86400)
puts("Warning: These data are obsolete");
else printf("Data was last accessed %lf seconds ago.n", x);
}
RELATED FUNCTIONS
time
SEE ALSO
Timing Functions