totn C Functions

C Language: difftime function
(Time Difference)

In the C Programming Language, the difftime function returns the difference (as measured in seconds) between time0 and time1. When using the difftime function, time0 is the earlier time.

Syntax

The syntax for the difftime function in the C Language is:

double difftime(time_t time1, time_t time0);

Parameters or Arguments

time1
The later time to use when calculating the difference in seconds.
time0
The earlier time to use when calculating the difference in seconds.

Returns

The difftime function returns the difference (as measured in seconds) between time0 and time1.

Required Header

In the C Language, the required header for the difftime function is:

#include <time.h>

Applies To

In the C Language, the difftime function can be used in the following versions:

  • ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the difftime function:

See Also

Other C functions that are noteworthy when dealing with the difftime function: