Mine isn't designed to tell you the difference between two dates. If you already have the $duration of that, then it will work correctly. Future dates don't matter for this script because it is using $duration which doesn't consider dates. Note also that as the header says, this is meant for $durations that are between the current date and going backwards as for use with $uptime. In that format, it will be completely accurate. If used in another way, it will be anywhere from 0 days to 3 days off. It should never be more than 3 days off (unless you go back far enough that you're back to the point in time where 12 days were added to the calendar).
Why 3 days? Because it checks months in order, it could be off because it thinks that it's one month when it's really another month. Months are 28-31 days. So, it could be off by up to 3 days because of that difference. It could also be right on the mark even if it's using another date than today's depending on the length of the $duration and the date it starts at.
I could easily set it up to allow a user to input a starting date (by starting, I mean the most future date as this is really meant to go backwards) and then it would be accurate all the time if the user enters the correct starting date. Whether or not I will do that, I am not sure.
And, yes... I did consider leap years. Check the 28 vs 29 section of the code.
I may have an update for my script done today with formatting and the $istok idea (that's already coded, but I don't see a need to paste that small update here).