compile function test_elap() $insert rds_equ Tans = '' Tot = 0 DateIn = '' TimeIn = '' DateOut = '' TimeOut = '' /* L1Date = @record L1Time = @record UXDate = @record UXTime = @record U1Date = @record U1Time = @record L2Date = @record L2Time = @record U2Date = @record U2Time = @record L3Date = @record L3Time = @record */ 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