The difftime() function is defined in ctime header file. The difftime() function is used to calculate the difference between two times in second.
double difftime(time_t end, time_t start);
Parameters: This method accepts two parameters:
- start: time_t object for start time.
- end: time_t object for end time.
Returns: This function returns the difference between two times in seconds.
Total time required = 2 seconds
- difftime() C library function
- Function Overloading vs Function Overriding in C++
- What happens when a virtual function is called inside a non-virtual function in C++
- div() function in C++
- fma() function in C++
- log() function in C++
- exp() function C++
- max() function for valarray in C++
- wcsncpy() function in C++ with example
- map rend() function in C++ STL
- real() function in C++
- map rbegin() function in C++ STL
- imag() function in C++
- isfinite() function in C++
- ios eof() function in C++ with Examples
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 Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.