[PATCH] Fix sys_time() to get subtick correction from the new xtime
From: "La Monte H.P. Yarroll" <piggy@timesys.com> This is a Scott Wood patch against 2.6.3. Use gettimeofday() rather than xtime.tv_sec in sys_time(), since sys_stime() uses settimeofday() and thus subtracts the subtick correction from the new xtime. stime() used settimeofday(), but time() did not use gettimeofday(). Since settimeofday() subtracts out the current intra-tick correction, and nsec was 0 (since stime() only allows seconds), this resulted in xtime being slightly earlier than the time that was set. If time() had used gettimeofday(), the correction would have been applied, and everything would be fine. However, instead time just reads the current xtime.tv_sec, so if time() is called immediately after stime(), you'll usually get a value one second earlier.
Showing
Please register or sign in to comment