getTime refactoring

Some refactoring of getTime() functions.