it sets endwait to be the current clock() value (presumably a timestamp) + a time to wait. It then goes into an empty loop until the clock() value becomes equal to endwait, at which point it exits the loop and continues. This technique is also known as a spinlock (link goes into some detail, certainly not required reading :icon_wink:)
Hi McQueen, basically all this code does is "pause" the program for a given number of seconds...The clock_t type name is part of the ctime header and is used when returning clock() variables (clock() is a function of the ctime header file)...the clock() function returns the number of clock ticks elapsed since the program was launched. the CLOCKS_PER_SEC variable is a const that specifies clock ticks per second...thus, the endwait variable is set to the number of clock ticks since the program started + the number of clock ticks to wait (based on a given number of seconds)...the while() loop iterates (do nothing on each iteration) until the requisite number of seconds (clock ticks) have passed...After the requisite time, the while loop will end and the function will complete...
Hope this helps!
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...