Avoid use of timedelta.total_seconds()

timedelta.total_seconds() is not available in Python versions previous to 2.7
In order to ensure compatibility with Python 2.6, instead of using
total_seconds, the total number of seconds is calculated from the seconds and
days propeties of timedelta.