Move clock logic into directive