change the time updating so that it doesn't happen every frame