[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Delay in millisecond
I have tested the following program:
struct timeval tv;
struct timeval tv2;
printf("Time before: %d\n", (int)tv.tv_sec);
for (i = 0; i < 1000; i++)
printf("Time after: %d\n", (int)tv2.tv_sec);
printf("Diff: %d\n", (int)tv2.tv_sec - (int)tv.tv_sec);
This program performs a 100 ms sleep 1000 times. The result is:
(in a perfect world with an infinite fast processor the expected result would
Can you test the program above and see if you get the same result?
If you get the same result I need to know more about your problem.
How is your program different from the example above?
From: firstname.lastname@example.org]On">mailto:email@example.com]On Behalf Of Nabil Daher
Sent: Tuesday, January 14, 2003 5:24 PM
Subject: Delay in millisecond
I have a problem with usleep()....When the sleep delay is under 1 second, the function return immediatly without waiting... How can I use a delay with a 100 millisec resolution in user space?
I use a Devboard LX with 2.4.19 Kernel.
udelay() and select() seem to have the some problem...
Thank you for any suggestion.