To address the question directly, I would want to know, how long are you setting
nanosleep() for, repsectively? While
sleep() takes an argument in seconds,
usleep() takes one in microseconds, and
nanosleep() (as the name implies) takes a structure that has both seconds and nanoseconds. if you are using
sleep() with an argument more than
60, then it would indeed seem as if the program has frozen; OTOH, an argument of
usleep() (just under 1/10 of a second) would be barely noticable, as would any nonoseconds argument less than
99999999 (again, just under 1/10 of a second) for
To get the resolution you want, you may need to make multiple calls to
nanosleep(), though that will still give you variable results as it does not guarantee a specific amount of time slept, only a minimum time.
You might also consider using
That having been said, what is the real purpose here? Why do you need to slow down the output, and what kind of output is it? Is this a delay for a video game or animation of some kind (in which case you may find a more suitable function in the graphics package you are using)?
I looked at the man pages and saw those were the maximum values of usleep() and nanosleep(). With sleep I thought I would get a normal 5 seconds. I am working on a modified version of game of life. It is hard to see if it is doing what I want with how fast it is going.
usleep(1000000); nanosleep(999999999); delay(3000); sleep(5);
write a C++ program which take inputs from the user/keyboard and calculate his ZAKAT.
get the input from user may include
-Amount invested in business
-Amount given to other business partners as loan
-Amount payable to others
I made a prime number finder, it finds the nearest prime that is above and below any integer (Does not work that well with giant numbers.)
Made this in cpp.sh
Why would I need the x=y+1-1;?
x=y; just doesnt seem to work
Why is this?
And I know my coding ...
there are five tables (personTb, addressTb,churchTb) each holds data pertinent to an individual; (personAddress,personChurch) each hold the primary key for the person table and corresponding table IE personAddress holds primary key for addressTb.
both snippets work, my question is; Is my join correctly formatted?
select concat(personTb.p_fName,' ',personTb.p_mName,'. ',personTb.p_lName) ...