[Ace-users] Re: ACE_Thread_Timer_Queue_Adapter large interval

Martin Lierschof mlierschof at vizrt.com
Tue Jul 10 06:53:41 CDT 2007


On 10 Jul., 12:10, waiting for <gunwithr... at gmail.com> wrote:
> On 7 10 ,   4 35 , "Martin Lierschof" <MLiersc... at vizrt.com> wrote:
>
>
>
> > Hi,
>
> > ACE VERSION: 5.5.1 (primary)
>
> > ACE VERSION: 5.5.8 (also tested)
>
> > HOST MACHINE and OPERATING SYSTEM:
>
> > Windows2000, WindowsXp (winsock2)
>
> > TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
>
> > Windows2000 (sp4) , WindowsXp (sp2) both running on winsock2
>
> > COMPILER NAME AND VERSION (AND PATCHLEVEL):
>
> > MS VC 7.1 (sp) / MS VC 8 (sp1) = tested on both
>
> > THE $ACE_ROOT/ace/config.h FILE:
>
> > #define ACE_ENV_BKWD_COMPAT
>
> > #include "ace/config-win32.h"
>
> > THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE:
>
> > None
>
> > CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features:
>
> > Default
>
> > AREA/CLASS/EXAMPLE AFFECTED:
>
> > ACE_Thread_Timer_Queue_Adapter
>
> > Templates:
>
> > <ACE_Timer_Wheel>
>
> > <ACE_Timer_Heap>
>
> > <ACE_Timer_Hash>
>
> > <ACE_Timer_List>
>
> > DOES THE PROBLEM AFFECT:
>
> > COMPILATION?
>
> > No
>
> > LINKING?
>
> > No
>
> > EXECUTION?
>
> > No
>
> > DESCRIPTION:
>
> > I measured some miscalculation in intervals while debugging with large
> > intervals. So what's the recommended max value for an Interval?
>
> > I tested with all Templates, but there was no difference between them,
> > always the same result.
>
> > Class:              ACE_Thread_Timer_Queue_Adapter
>
> > Templates:        all:
>
> >                         ACE_Timer_Wheel
>
> >             ACE_Timer_Heap
>
> > ACE_Timer_Hash
>
> > ACE_Timer_List
>
> > Description:      Problems scheduling, intervals larger than ~ 7 days,
> > definitive 10 days
>
> > Calculation:       scheduled interval = 3600s (1 hour) * 24 (1day) * 10
> > (10 days) = 864000s
>
> > Start time:        30.06.2007 00:00:00
>
> > Debugged in Timer_Queue_Adapters.cpp line: 261
>
> > Excepted handle timeout:
> > 10.07.2007 00:00:00
>
> > Timeout calculated while in debug Timer_Queue_Adapter:
> > 15.07.2007 00:00:00
>
> > I'll be pleased if there is a workaround / fix / other timer adapter.
>
> > My current workaround is scheduling just for one hour but this seems
> > more than a dirty hack for this problem.
>
> > Thanks in advance
>
> > Martin Lierschof
>
> I had used this timer adapter,and no problem!
> I think you get the wrong absolute time of start time.please check it!
> You can compare your answer with the follow:
> Start time:        30.06.2007 00:00:00         absolute time:
> 1183132800s
> Excepted timeout : 10.07.2007 00:00:00    absolute time:   1183996800s
>
> 1183996800s - 1183132800s = 864000s

i know how to calculate this thime in ACE_Time_Value, but i displayed
as ACE_Date_Time, but the miscalculation is still the same.
so just here is more information:

#define __Timer_Heap

#ifdef  __Timer_Wheel
#include "ace/Timer_Wheel.h"
typedef ACE_Thread_Timer_Queue_Adapter<ACE_Timer_Wheel> ActiveTimer;
#endif

#ifdef  __Timer_Heap
#include "ace/Timer_Heap.h"
typedef ACE_Thread_Timer_Queue_Adapter<ACE_Timer_Heap> ActiveTimer;
#endif

#ifdef  __Timer_Hash
#include "ace/Timer_Hash.h"
typedef ACE_Thread_Timer_Queue_Adapter<ACE_Timer_Hash> ActiveTimer;
#endif

#ifdef __Timer_List
#include "ace/Timer_List.h"
typedef ACE_Thread_Timer_Queue_Adapter<ACE_Timer_List> ActiveTimer;
#endif

ActiveTimer atimer;
int iSomeValue = 0;
CVTask pCVTask = new CVTask(iSomeValue);

const ACE_Time_Value tvIntervalNew(864000);
const ACE_Time_Value tvStartTime(1151666790);

long lRealTimerID = atimer.schedule(pCVTask, pTimerID, tvStartTime,
tvIntervalNew);

//Timer_Queue_Adapter.h line: 261

ACE_Time_Value tv = this->timer_queue_->earliest_time ();
//tv Value = 1184498790

//tv 		     1184498790
//-tvStartTime	1151666790
//--------------------------
//		     32832000
//============	NO GOOD !

Additional Information:
*just 1 Task is scheduled
*callback handle_timeout fires immediately after scheduling ( this is
where i debug into ACE_Timer_Queue )
*class CVTask : public ACE_Event_Handler
*class CVTask has private member : virtual int handle_timeout(const
ACE_Time_Value &tv,const void *arg);
*Tested all Templates



More information about the Ace-users mailing list