C Program to Calculate Difference Between Two Time Periods

To understand this example, you should have the knowledge of the following C programming topics:


Calculate Difference Between Two Time Periods

Output

Enter the start time.
Enter hours, minutes and seconds: 13
34
55
Enter the stop time.
Enter hours, minutes and seconds: 8
12
15

Time Difference: 13:34:55 - 8:12:15 = 5:22:40

In this program, the user is asked to enter two time periods and these two periods are stored in structure variables startTime and stopTime respectively.

Then, the function differenceBetweenTimePeriod() calculates the difference between the time periods. The result is displayed from the main() function without returning it (using call by reference technique).