[uClinux-dev] usleep takes longer as expected

Siegfried Müller mueller at mbconnectline.de
Mon Feb 4 10:57:04 EST 2008


Hi,
I work with the snapgear distro 3.4 and uClibc. 
I use usleep to wait for an exact time, but usleep takes a minimum
of 10.000usec. If i use usleep(100) it takes 10.000usec. Why?
 
int main(int argc, char *argv[])
  int i1=0;
  struct timeval mytime;
  struct timezone mytimezone;
  
  while(i1 < 10){
    gettimeofday(&mytime,&mytimezone); 	
    printf("Test %d, usec=%d,
sec=%d\n",i1,mytime.tv_usec,mytime.tv_sec);
    usleep(100);
    i1++;
  }
}
Does anyone has an idea?
Cheers
Siegfried



More information about the uClinux-dev mailing list