Update the implementations of gettimeofday() and localtime_r()