[ace-users] gettimeofday() and schedule

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Wed Aug 22 09:11:30 CDT 2007


Hi Scott,

To ensure that we have proper version/platform/compiler information,
please make sure you fill out the appropriate problem report form
(PRF), which is in

$ACE_ROOT/PROBLEM-REPORT-FORM
$TAO_ROOT/PROBLEM-REPORT-FORM

or in

$ACE_ROOT/BUG-REPORT-FORM
$TAO_ROOT/BUG-REPORT-FORM

in older versions of ACE+TAO.  Make sure to include this information
when asking any questions about ACE+TAO since otherwise we have to
"guess" what version/platform/compiler/options you've using, which is
very error-prone and slows down our responsiveness.  If you don't use
the PRF, therefore, it is less likely that someone from the core
ACE+TAO developer team will be able to answer your question.
Naturally, we encourage and appreciate other members of the ACE+TAO
user community who can respond to questions that they have the answers
to.

>I'm using the following code:
>
> ACE_Time_Value expireAt = timerQueue().gettimeofday () + delay;
> timerQueue().schedule(eventHandler, arg, expireAt);
>
>The delay is set to 2 seconds.
>
>So this works fine - the timer fires every two seconds and the routine
>is called.
>
>The problem is that when the system's time is changed to go backward
>(with the "date" command in linux) the timer always has that much more
>delay in it.  E.g: if I set the time back 30 seconds, the next
>expiration will be 32 seconds, and then 2 after that.
>
>Is there any routine I can call in ACE to do the same thing but have
>it automatically adjust to the system clock's change - i.e. continue
>expiring every two seconds if if the system's time is changed.

Please check out ACE_High_Res_Timer::gettimeofday_hr.  There's a
discussion of this in a sidebar in Chapter 3 of C++NPv2
<www.cs.wustl.edu/~schmidt/ACE/book2/>.  Steve, do you have any other
suggestions here?

Thanks,

        Doug
-- 
Dr. Douglas C. Schmidt                       Professor and Associate Chair
Electrical Engineering and Computer Science  TEL: (615) 343-8197
Vanderbilt University                        WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203                          NET: d.schmidt at vanderbilt.edu



More information about the Ace-users mailing list