Comparing two dates (RTC vs. some given date) and getting delta time w/ leapyear

I have recently purchased a DS3231 Real Time Clock and have started playing with the examples.

I'm also new to the DateTime library (and so far think its pretty neat).

I was wondering if anyone may have a suggestion of ways to compare two dates? eg. get the number of years/days between them?

I can imagine that simply calculating the difference between the total seconds of the two dates would indicate if the one were less, equal or greater than the other, but I not certain this would work for leap years as it only assumes multiples of 365 and does not account for the 366th day every 4 years?...

Does Arduino's DateTime library have the ability to calculate time delta (given the current date and some input day of month, month of year and a year)?

Any suggestions would be of so much help!

By far the easiest way is to use epoch (32 bit Unix) times, and simply subtract one from the other.
"This library has been superseded by a newer version that is available here"
"Update: newer versions of Time, TimeAlarms, and DS1307RTC are available, featuring more updates for newer version of Arduino and compatibility with Arduino Due.
The code is derived from the earlier Playground DateTime library but is updated to provide an API that is more flexible and easier to use."
The 'time_t' value is a value in seconds (since January 1, 1970). They can be compared directly. Divide the difference by 246060 to get days between the two dates.
It's not clear what value you want for "the number of years between them". You could compare year(time1) to year(time2) to get the difference in 'years' but if you want 'age' you will need to compare the difference in 'month()' and if the months are the same you need to compare the difference in 'day()' to see if the birthday has passed in the later date.