difftime
raw OCR
Computes the difference between two times.
Defined in header <time.h>
Syntax
#include <time.h>
double difftime(time_t time!, time_t timel);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ | ■ |
Remarks
difftime calculates the elapsed time in seconds, from timel to time!.
Return value
difftime returns the result of its calculation as a double.
See also
Example
#include <time.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>
int main(void)
{
time_t first, second;
clrscrO ;
first = time(NULL); /* gets system time */
delay(2000); /* waits 2000 millisecs or 2 sees */
second = time(NULL); /* gets system time again */
printfC'The difference is: %f seconds\n" ,difftime(second,first));
getchO ;
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/time.h/difftime/
· short form /3.1/difftime/