Since we're comparing local time to database time, we need to correctly
handle negative offsets to account for clock skew. The datetime.timedelta
class always reports a positive number of seconds, but with a possibly
negative number of *days*. Therefore, take the days into account.
Change-Id: I4422e4cf41cb57cdc89548d01b0abc27cda914ef
Closes-Bug: #1688327