Refactoring getTime() to fix compiling problems