clock() - Does it work?

Andy Green andy at warmcat.com
Mon Sep 10 10:13:39 UTC 2007


Somebody in the thread at some point said:
> Hi,
> 
> I have an animation program that uses the clock() function
> for synchronization. It works fine with MinGW 3.2, but not with gcc
> 4.1.2 (FC6).
> 
> In the later case, clock() always return 0. I saw some people pointing

clock() is telling you about how much CPU time your process has eaten.

It sounds like you want to use select() with empty sets for the file
descriptors and a timeout that reflects how long you wanted to sleep.

You can use gettimeofday() like you already are to work out how long you
want to sleep.

-Andy




More information about the users mailing list