[uClinux-dev] usleep takes longer as expected

Chris Doré cdore at connecttech.com
Mon Feb 4 11:09:48 EST 2008


Do you mean 10msec?  Your subject asks about usleep() taking more time than
expected, but then your reported results show that it takes less time than
expected.


..Chris

> -----Original Message-----
> From: uclinux-dev-bounces at uclinux.org [mailto:uclinux-dev-
> bounces at uclinux.org] On Behalf Of Siegfried Müller
> Sent: February 4, 2008 10:57 AM
> To: 'uClinux development list'
> Subject: [uClinux-dev] usleep takes longer as expected
> 
> 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
> 
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev



More information about the uClinux-dev mailing list