time() and gettimeofday() return different seconds
问题 On the two systems I've tested (a 32-bit Ubuntu 12.04 server and a 64-bit Ubuntu 13.10 VM), the seconds since the epoch given by time() may differ from gettimeofday()'s. Specifically, though I call time() after calling gettimeofday() , the value returned by time() is sometimes less than the tv_sec value returned by gettimeofday() . This apparently occurs just after the clock rolls over to a new second. This caused bugs in some of my code that expected time()'s and gettimeofday()'s seconds to