COHERENT manpages
This page displays the COHERENT manpage for difftime() [Calculate difference between two times].
List of available manpages
Index
difftime() -- Time Function (libc) Calculate difference between two times #include <time.h> double difftime(newtime, oldtime) time_t newtime, oldtime; difftime() subtracts oldtime from newtime, and returns the difference in seconds. Both arguments are of type time_t, which is defined in the header time.h. Example This example uses difftime() to show an arbitrary time difference. #include <stdio.h> #include <stdlib.h> #include <time.h> main() { time_t t1, t2; time(&t1); printf("Press enter when you feel like it.\n"); getchar(); time(&t2); printf("You waited %f seconds\n", difftime(t2, t1)); return(EXIT_SUCCESS); } See Also clock(), libc, mktime(), time [overview] ANSI Standard, §7.12.2.2