I'm trying to count the days between two dates. So far I am using an overloaded operator function so when it subracts it performs a series of calculations as well.
The first operator is a Date Class with the year,month,day. Basically, I make the second Date_time a constant so I cannot change the variables, and then increment the number of months and years in the first operator util it is equivalent to that of the constant. While incrementing the months, I also take a counter and add the total number of days from that month to a temporary counter. Once I actually get to the month and year.
Right now it's take really long to perform these calculations and its giving me weird numbers like -3224252233. Any thoughts?
There is also the method of the julian day number. Convert your two dates in julian day numbers then substract them. A 32bit julian day number should cover a wider range of time than a 32 bit time_t obtained by mktime i think