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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- difftime() C library function
- What happens when a virtual function is called inside a non-virtual function in C++
- Function Overloading vs Function Overriding in C++
- Difference between Virtual function and Pure virtual function in C++
- How to call some function before main() function in C++?
- How to call function within function in C or C++
- Difference between user defined function and library function in C/C++
- Difference between virtual function and inline function in C++
- Can we call an undeclared function in C++?
- Can we use function on left side of an expression in C and C++?
- Declare a C/C++ function returning pointer to array of integer pointers
- Function overloading and return type
- Function Pointer in C
- Default arguments and virtual function
- Function overloading and const keyword
- How to measure time taken by a function in C?
- Comparator function of qsort() in C
- Can we access private data members of a class without using a member or a friend function?
- Function Overloading and float in C++
- Extra brackets with function names in C/C++
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.