Refactor time related utils into time.py

Reviewers: marcua

Reviewed By: marcua

Differential Revision: http://phabricator.locu.com/D3380