[UnrestrictLi] Fix secondsToMidnight on python 2.5 & 2.6