I just cannot come up with a simple algorithm to find the difference in seconds between two 24 hour times.
The roll over at midnight is an impossible barrier to avoid an algorithm that does not involve a massive list if if statements covering all the possibilities.
Even converting the two times to seconds does not solve the problem - the roll over at midnight still gets in the way.
boylesg:
I just cannot come up with a simple algorithm to find the difference in seconds between two 24 hour times.
The roll over at midnight is an impossible barrier to avoid an algorithm that does not involve a massive list if if statements covering all the possibilities.
Even converting the two times to seconds does not solve the problem - the roll over at midnight still gets in the way.
Does anyone know how to do it?
@boylesg, this is probably the reason the computing world uses timestamps and not clock face time... it is then simple subtraction.
take a look at my DailyTimer library, which makes extensive use of your problem using a method to convert any time to a timestamp: