I think you should have a look at the Date::Range module. After reading its POD, it looks like, in particular, the gap() method is almost exactly what you're looking for. You may have to massage your input data into a format understood by Date::Range, but that shouldn't be too hard.
I hope this helps...Good luck!
Update: Ugg! It looks like I jumped the gun; this would be an excellent solution for ranges of dates, but doesn't appear to deal with time-resolution. Sorry! ;)