]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Use correct time delta function
authorKevin Benton <blak111@gmail.com>
Thu, 28 May 2015 23:48:04 +0000 (16:48 -0700)
committerKevin Benton <blak111@gmail.com>
Fri, 29 May 2015 00:01:47 +0000 (17:01 -0700)
commita0c9745e90596d4a3207e844332e078ca7ecc5fa
tree7a330d7888d02921e58130d9976356396607ada5
parent8f741f97e40cee6d482c0d2da01a820a666b01a0
Use correct time delta function

The .seconds attribute of a timedetla object cannot be taken in
isolation because it can overflow into days. For example, a -1 second
difference will become -1 day and 86399 seconds.

This became a problem when the agent clock was slightly ahead of
the server clock. When calling (server_time - agent_time).seconds
in this scenario, it would go below 0 in the daily seconds and
wraparound to 86399 seconds and -1 day.

This patch corrects the issue by using a method in timeutils that
ends up calling total_seconds(), which was designed for this usecase.
It also restores the formatting that was removed in patch:
Ibfc30444b7a167fb18ae9051a775266236d4ecce

Closes-Bug: #1456760
Change-Id: Ie90249ab68bb5f8d117872d52180c7087d8fac9b
neutron/db/agents_db.py