refactoring getAllTime