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