in reply to Re^2: Parent process finished. How to exit the child process.
in thread Parent process finished. How to exit the child process.
I want to measure the time and display it while the game is going on.So you want to display kind of "running stopwatch", updated every second?
Since sleep(1) is unreliable, you can't use counting. Instead I suggest you use the following approach: You use a high-resolution timer (for example, Time::HiRes), sleep for around 0.1 or 0.2 seconds (of course, the *actual* sleep time will differ from this too a bit), and instead of counting, use time and simply display the actual time.
The only purpose of using the hires timer instead of the normal sleep is to make the update of the display more smoothly.
|
|---|