   Pausing in ncurses?
  Hello everyone!Quick question; what's a cross-platform way to sleep/delay/pause some milliseconds with ncurses?Thanks in advance!   
  The only true cross platform way I'm aware of is to make use of the C functions available in <ctime.h>.  Basically, you query for the current time, store it in a variable and consider this the start time. After that go into a loop and keep querying for the time until it is some number of milliseconds after the start time.  This is not a high performance counter as many things may affect your ability to be completely accurate but unless your application is super time critical it may not be an issue.   ;  Hmm, aren't C's time functions second-based? That's not an enough resolution... :-/Thanks!   ;  The way I've seen millisecond based sleeping done on unix in the old days was to use select's timeout mechanism, which specifies the timeout in milliseconds.   ;  If you want reliable pausing, don't use sleep.  It's just a suggestion to the OS for how long to sleep your app:http://msdn2.microsoft.com/en-us/library/ms686298.aspx"Suspends the execution of the current thread for at least the specified interval."It could be longer, much longer.If you need accurate timing and pausing, just use a tight loop that checks some timer function.Sleep is used to make your application play nice with the rest of the OS: give time for other applications to update and whatnot.-me   ;Quote:Original post by PalidineIf you want reliable pausing, don't use sleep.Yet often times I see applications that do what you suggest (poll a timing function in a tight loop), gobbling up 100% of the CPU when it isn't necessary.Really think hard before you do this polling technique because its very CPU intensive.  Only do it if you have a really good reason and even then think twice about doing it.Why do I say this?  Because I've seen too many games gobbling 100% of my CPU when I pause them.  Its freaking paused!  Why are you eating my CPU!?!?  And no, they weren't games with networking that needed to stay synched with other players, they were just created by shitty programmers.   