compile function test_elap()

$insert rds_equ

Tans = ''
Tot = 0
DateIn  = ''
TimeIn  = ''
DateOut = ''
TimeOut = ''
/*
L1Date  = @record<rds_date_in$>
L1Time  = @record<rds_time_in$>
UXDate  = @record<rds_date_out$>
UXTime  = @record<rds_time_out$>

U1Date  = @record<rds_op_out_ex1_date$>
U1Time  = @record<rds_op_out_ex1_time$>
L2Date  = @record<rds_op_in_ex2_date$>
L2Time  = @record<rds_op_in_ex2_time$>
U2Date  = @record<rds_op_out_ex2_date$>
U2Time  = @record<rds_op_out_ex2_time$>
L3Date  = @record<rds_op_in_ex3_date$>
L3Time  = @record<rds_op_in_ex3_time$>
*/

L1Date  = iconv( '3/1/01', 'D' )
L1Time  = iconv( '12:00PM', 'MTH' )
UXDate  = iconv( '3/2/01', 'D' )
UXTime  = iconv( '1:00PM', 'MTH' )

U1Date  = iconv( '3/1/01', 'D' )
U1Time  = iconv( '1:00PM', 'MTH' )
L2Date  = iconv( '3/1/01', 'D' )
L2Time  = iconv( '3:00PM', 'MTH' )

U2Date  = iconv( '3/2/01', 'D' )
U2Time  = iconv( '1:00AM', 'MTH' )
L3Date  = iconv( '3/2/01', 'D' )
L3Time  = iconv( '2:00AM', 'MTH' )

*First Run = 1 Hour; Second Run = 10 Hours; Third Run = 11 Hours; Total = 22 hours

if U2Date then
   DateOut = U1Date
   TimeOut = U1Time
   DateIn  = L1Date
   TimeIn  = L1Time
   gosub CalcElapsed
   DateOut = U2Date
   TimeOut = U2Time
   DateIn  = L2Date
   TimeIn  = L2Time
   gosub CalcElapsed
   DateOut = UXDate
   TimeOut = UXTime
   DateIn  = L3Date
   TimeIn  = L3Time
   gosub CalcElapsed
end else
   if U1Date then
	   DateOut = U1Date
	   TimeOut = U1Time
	   DateIn  = L1Date
	   TimeIn  = L1Time
	   gosub CalcElapsed
	   DateOut = UXDate
	   TimeOut = UXTime
	   DateIn  = L2Date
	   TimeIn  = L2Time
	   gosub CalcElapsed
   end else
      DateOut = UXDate
      TimeOut = UXTime
      DateIn  = L1Date
      TimeIn  = L1Time
      gosub CalcElapsed 
   end
end
transfer Tot to @ans
*******************************************************************************
CalcElapsed:
	if DateOut and DateIn then
	   DateDiff = DateOut - DateIn
	   SecondsToAdd = 0
	   if DateDiff then
	       SecondsToAdd = 86400*DateDiff
	   end
	   Tans = ( TimeOut + SecondsToAdd ) - TimeIn
	   Tot += ( ( Tans /3600) *100 )
	end
return
