The C library function difftime() returns the difference, in seconds between starting time and ending time.(ending time-starting time)
// It is present in time.h header file #include Syntax : double difftime(time_t time2, time_t time1); Parameters: time1 : Lower bound of the time interval whose length is calculated. time2 : Higher bound of the time interval whose length is calculated. Return value : Returns the difference between time1 and time2 (as measured in seconds).
Difference is 6.00 seconds
This article is contributed by Shivani Ghughtyal. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- time() function in C
- isgraph() C library function
- How to write your own header file in C?
- Callbacks in C
- strpbrk() in C
- stringstream in C++ and its applications
- tmpnam() function in C
- _Generic keyword in C
- C/C++ Preprocessor directives | Set 2
- C/C++ Preprocessors
- typedef versus #define in C
- Merge operations using STL in C++ | merge(), includes(), set_union(), set_intersection(), set_difference(), ., inplace_merge,
- How to find length of a string without string.h and loop in C?
- Variable length arguments for Macros
- Write a C macro PRINT(x) which prints x