Move timer function into the backend interface to remove dependency on
gettimeofday.