Originally Posted by
Adak
You are doing the time calculation yourself - so you don't need time.h. time.h is used mostly when your program needs to work with the reported times from the computer.
You can keep all your variables about time, as integers, since you have the time broken down into years, days, hours, and minutes. If the time used is 2 hours and 28 minutes, for instance, you don't need to work with 2.47 hours.
To make your math right, start with the largest quantity, and calculate it first: years. Then get the elapsed months, followed by days, and finally hours and minutes. What you want to do is decide what the rate you're program is charging, will be set up for - do you want to charge by the minute, or by the hour, or ??
Next, make any calculations that apply for different time periods - looks like 5 hours is one such period.
Once that's done, have your math change each of these elapsed time units which are greater than zero, into the basic time units you want to charge, and you're good to calculate the rest of the charge.