Use global variable to keep track of time.