Rework time handling in periodic tasks.

Update time calculations in the periodic task handling to use the
timeutils module from oslo. This provides benefits for unit testing,
since we can easily override the time functions to simulate time
differences without having to actually sleep and make the unit tests
run unnecessarily long.

Resolves bug 1098979.

Change-Id: I1e6a0a0b1622a3f8c37c42376f5261f5f2dbf6fe