Calculate time on directive