of_recalcinterval


pfcapsrv.pbl   >   pfc_n_cst_tmgmultiple   >   of_recalcinterval   

Full name pfc_n_cst_tmgmultiple.of_recalcinterval
Access public
Extend of long
Return value long
Prototype public function long of_recalcinterval()

Name Datatype
No Data

Name Datatype
li_cnt integer
li_idx integer
ll_gcd long

public function long of_recalcinterval ();//////////////////////////////////////////////////////////////////////////////
//
//	Function: of_ReCalInterval
//
//	Access:  protected
//
//	Arguments: None
//
//	Returns: integer
//	# - The new interval
//	ERR = -1
//
//	Description:
//	Calculates a new interval.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	6.0   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

integer	li_cnt
integer	li_idx = 1
long  	ll_gcd = 0

// Find the first valid entry and get it's interval
li_cnt = upperbound(inv_tmgregister)
Do While li_idx <= li_cnt 
	If isvalid(inv_tmgregister[li_idx].ipo_notify) Then
		ll_gcd = inv_tmgregister[li_idx].il_notifyinterval
		Exit
	End If
	li_idx++
Loop

If ll_gcd > 0 Then 
	// We found a valid entry.
	// Now look at the rest of the intervals and determine 
	//	the GCD (greatest Common Divisor).
	Do While li_idx < li_cnt 
		li_idx++
		If isvalid(inv_tmgregister[li_idx].ipo_notify) Then
			ll_gcd = of_GCommonDenominator(inv_tmgregister[li_idx].il_notifyinterval,ll_gcd)
			If ll_gcd = 1 Then 
				// No sense in looking further, 1 is the smallest number we handle.
				Exit 
			End If
		End If
	Loop
End If

// Check if the GCD is greater than the maximum PB interval supported.
if ll_gcd > 60 then
	ll_gcd = of_GCommonDenominator(ll_gcd, 60)
end if

// Set and Start the new timer interval.
il_interval = ll_gcd
itmg_requestor.Start(il_interval)
Return il_interval

end function

     
Name Owner
pfc_n_cst_tmgmultiple.of_unregister pfc_n_cst_tmgmultiple
pfc_n_cst_tmgmultiple.of_unregister pfc_n_cst_tmgmultiple
pfc_n_cst_tmgmultiple.of_register pfc_n_cst_tmgmultiple
pfc_n_cst_tmgmultiple.pfc_timer pfc_n_cst_tmgmultiple

     
Name Owner
timing.start timing
systemfunctions.isvalid systemfunctions
systemfunctions.upperbound systemfunctions
pfc_n_cst_tmgmultiple.of_gcommondenominator pfc_n_cst_tmgmultiple

     
Full name
No Data

     
Name Scope
No Data