Refactoring Time class