Name
difftime
Synopsis
Calculates the difference between two arithmetic time values
#include <time.h> doubledifftime( time_ttime2, time_ttime1);
The difftime() function
returns the difference between two time values,
time2 − time1,
as a number of seconds. While difftime() has the return type double, its arguments have the type
time_t. The time_t type is usually, but not
necessarily, defined as an integer type such as long or unsigned
long.
A common way to obtain the argument values passed to difftime() is by successive calls to the
time() function, which returns
the current time as a single arithmetic value.
Example
See the sample program for clock() in this
chapter.
See Also
asctime(), ctime(), gmtime(), localtime(), mktime(), strftime(), time()
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access