Use timestamp in periodic tasks

All time related data in periodic tasks are in seconds.
Therefore creating datetime objects only adds overhead to the module.
This patch replaces all datetime objects with utc timestamps in periodic_tasks.
Changes to test scripts were made accordingly.

Change-Id: I5bf77fba26aac62856fe30585577b7cf66dd6257
Refactor if logic in periodic_task

Currently we are checking twice whether spacing is None.
Since due-now is always smaller than spacing we can combine the two
if statements.

Change-Id: Icd354c8f9dd9988c9c985283abee7c852d2c13b2