More refactoring on timecalc.py.