HW10: A TimeKeeper Module Overview We often find that we have need for a data structure to represent time. Time can be implemented in several different ways - for example, using a long int, or using a struct with different fields for the hours, minutes and seconds. Regardless of the implementation, we must be able to perform the following actions: Set the current time. Calculate the interval between two times. Calculate an end time given a start time and an interval. Compare two time values. Build a time value from input. Print a time value. Your Assignment Implement and test a C data structure to represent a Timekeeper and functions to manipulate the Timekeeper. That is, you are to create a module that contains the following: A header/interface (timekeeper.h) file which contains the data structure declaration as well as the prototypes for the functions listed below. An implementation (timekeeper.c) file which contains the definitions of the functions (as well as anything else you deem appropriate for that file). The Interface: struct Time { int hr; int min; int sec; }; typedef struct Time Time; NOTE: Hours, minutes and seconds are always positive quantities. Also, the numerical value of seconds can not be greater than 59 and the numerical value of minutes can not greater than 59. Thus: 0 <= hr ; 0 <= min < 60 ; 0 <= sec < 60 . The Function Prototypes: void Time_set(Time *t, int hr, int min, int sec); /* Sets time to hr:min:sec */ Time Time_clr(Time *t); /* Sets time, *t, to 00:00:00 */ /*Note that Time_clr returns a zeroed time, too */ int Time_cmp(Time t1, Time t2); /* Compares t1 and t2, returns*/ /* <0 if t1 < t2, 0 if t1 == t2 */ /* >0 if t1 > t2 */ void Time_fprintf(FILE *f, Time t); /* Write t as hh:mm:ss to f */ void Time_fscanf(FILE *f, Time *t); /* Read 3 ints - hr min sec from f */ /* and set t using them */ int Time_hoursOf(Time t); /* Returns hours portion of t */ int Time_minutesOf(Time t); /* Returns minutes portion of t */ int Time_secondsOf(Time t); /* Returns seconds portion of t */ Time Time_between(Time t1, Time t2); /* Returns time betwen t1 and t2 */ /*time is never negative, so this must be between the */ /*later time, minus the earlier time*/ Time Time_endOf(Time t1, Time t2); /* Given starting time t1 and duration t2 */ /* returns ending time */ A Sample Use of Time main () { Time t1, t2, t3, t4; TimeSet(&t1, 14, 12, 3); TimeSet(&t2, 0, 5, 2); t3 = Time_between(t2, t1); Time_fprintf(stdout, t3); t4 = Time_between(t1, t2); Time_fprintf(stdout, t4); Time_fscanf(stdin, &t3); Time_fprintf(stdout, t3); } Test your module carefully and make sure that the functions meet the specifications as given above. WHAT TO SEND TO TOTEACH: timekeeper.c timekeeper.h