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 email@example.com. 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.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- difftime() function in C++
- isgraph() C library function
- wcstof function in C library
- How to print range of basic data types without any library function and constant in C?
- <algorithms> library in C++ STL
- <strings> library in C++ STL
- <regex> library in C++ STL
- <numeric> library in C++ STL
- snprintf() in C library
- SDL library in C/C++ with examples
- <iterator> library in C++ STL
- Set in C++ Standard Template Library (STL)
- The C++ Standard Template Library (STL)
- Map in C++ Standard Template Library (STL)
- Advanced C++ with boost library
- Pattern Searching using C++ library
- boost::split in C++ library
- wprintf() and wscanf in C Library
- Any datatype in C++ boost library
- C Library math.h functions