On Wed, 11 Jul 2001 18:47:27 +0200, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>  said:
> One update a widget. The latter control a process quering the system by
> "clock" POSIX function e updating a label with the time value.
> 
> Why the time value in the label changes slower that real-time?
> 
> That is. I start countdown. After real 5 minutes the label display 3
> minutes.

1) clock() returns CPU time used, not clock time.

2) A fairly common error is a variant of the following:

     while (1) {
           /* do processing that takes 1 second */
           wakeup_in_10_seconds();
     }

and then wondering why it doesn't wake up every 10 seconds.  The
right answer is to use gettimeofday() and keep track of the delta
since the last time you went to sleep, not from the current time.

-- 
                                Valdis Kletnieks
                                Operating Systems Analyst
                                Virginia Tech

PGP signature

Reply via email to