Add a printTime() function.

Reduces code by over 65 lines!