Moved time manipulation stuff to its own c file