Function difftime

Top 

Declaration:

unsigned long difftime(int time1[], int time2[]);

Description

Obtains the time difference between the two counts transferred in the time1 and time2 arrays. The counts should be obtained with the gettime function; time1 is the earlier count.

Because the gettime function uses the system timer, computation error for the interval can be as long as 104 milliseconds.

Returned value

The time difference between two counts in milliseconds.

Example

int time1[4];

int time2[4];

gettime(time1);

while (1)

{

  gettime(time2);

  printf("Difference: %lu", difftime(time1, time2));

}