Why do you want to wait 10ms (what is your application and what kind of an OS are you using)?
[email protected] wrote: > --- In [ mailto:[email protected] [EMAIL PROTECTED], "Brett W. > McCoy" <[EMAIL PROTECTED]> wrote: >> On 12/20/06, 1512 1521 <[EMAIL PROTECTED]> wrote: >>> I need to create a for loop for 10ms, how can I calculate 10 ms? >>> >>> for (i=0,i<??,i++) =>10ms >>> .... >>> ... >>> ... >>> for (i=0,i<??,i++) =>10ms >>> >> You can't. You should use timer functions for this, like the >> POSIX functions sleep, alarm, etc. If you are using Win32, >> there are equivalent functions, I am sure (I don't know what >> they are), refer to the documentation for your compiler >> >> -- Brett > > On POSIX conformant systems, there's a system call named "usleep()" > which takes a number of microseconds as its parameter and has the > process sleep (at least) the given amount of time. > > Unfortunately Windows doesn't offer this function; here you will have > to set up a timer which will notify your application via the usual > message queue as soon as the timer has expired. > > Regards, > Nico > > > > > > > > > > ------------------------------------------------------------------------ > > > > --- In [email protected] <mailto:c-prog%40yahoogroups.com>, "Brett W. > McCoy" <[EMAIL PROTECTED]> wrote: > > > > On 12/20/06, 1512 1521 <[EMAIL PROTECTED]> wrote: > > > > > > I need to create a for loop for 10ms, how can I calculate 10 ms? > > > > > > for (i=0,i<??,i++) =>10ms > > > .... > > > ... > > > ... > > > for (i=0,i<??,i++) =>10ms > > > > > > > You can't. You should use timer functions for this, like the > > POSIX functions sleep, alarm, etc. If you are using Win32, > > there are equivalent functions, I am sure (I don't know what > > they are), refer to the documentation for your compiler > > > > -- Brett > > On POSIX conformant systems, there's a system call named "usleep()" > which takes a number of microseconds as its parameter and has the > process sleep (at least) the given amount of time. > > Unfortunately Windows doesn't offer this function; here you will have > to set up a timer which will notify your application via the usual > message queue as soon as the timer has expired. > > Regards, > Nico > > To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/c-prog/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/c-prog/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
