Update function for time counter.