Dad asked me to try a question yesterday. Let's see how far I can reach here. Q. WAP to accept the starting date and time and the ending date and time and find the total time in minutes that has transpired in between. Once that is done, I'll have to continue with two conditions. One, Sunday should not be counted. No hours or minutes belonging to Sunday. Two, No time between 6pm and 10am should be counted either. A. Under way... Before I can start, I need to learn the date time functions available for use in the C library. I've taken the help of cplusplus.com. It has provided me with the following: Fact #1:The <time.h> headerfile has a number of functions dealing with time. time_t is the derived datatype used to create variables storing seconds in decimal form. It is almost universally expected to be an integral value representing the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC struct tm The structure contains nine members of type int, which are (in any order):
The meaning of each is:
* tm_sec is generally 0-59. Extra range to accommodate for leap seconds in certain systems. Time manipulation
Conversion:
|