sys_jiffies(): set sec and usec correctly from gettimeofday(), and avoid sec overflow

This commit is contained in:
jifl 2008-06-19 15:31:12 +00:00
parent 6de783946f
commit 579c7a3df4

View File

@ -587,10 +587,12 @@ unsigned long
sys_jiffies(void)
{
struct timeval tv;
unsigned long sec = tv.tv_sec;
long usec = tv.tv_usec;
unsigned long sec;
long usec;
gettimeofday(&tv,NULL);
sec = tv.tv_sec - starttime.tv_sec;
usec = tv.tv_usec;
if (sec >= (MAX_JIFFY_OFFSET / HZ))
return MAX_JIFFY_OFFSET;