move logic to time class