2.1.8.6 difftime


Description

The difftime function computes the difference between the two supplied time values timer0 and timer1.

Syntax

double difftime( time_t timer1, time_t timer0 )

Parameters

[input] timer1
Ending time;
[input] timer0
Beginning time

Return

the elapsed time in seconds, from timer0 to timer1. The value returned is a double-precision floating-point number.

Examples

EX1

void difftime_ex1()
{
    time_t   start, finish;
    long loop;
    double   result, elapsed_time;
 
    printf( "Multiplying 2 floating point numbers 100 thousand times...\n" );
 
    time( &start );
    for( loop = 0; loop < 100000; loop++ )
       result = 3.63 * 5.27; 
    time( &finish );
    elapsed_time = difftime( finish, start );
    printf( "\nProgram takes %6.0f seconds.\n", elapsed_time );
}

Remark

See Also

Header to Include

origin.h

Reference