0
My VerifyOnServ(nTimeOut)
, is not always obeying the nTimeOut
past, either because of it or the server with which it communicates.
So I needed an insistence on his execution nTimeOut
Follows the code:
cTic := Time()
While .Not. lExpired
cResponse := VerifyOnServ(nTimeOut)
cTac := Time()
If cResponse != nil
exit
EndIf
cElapsed := ElapTime(cTic, cTac)
nElapsed := VAL(SUBSTR(cElapsed, 1, 2))*(3600) + VAL(SUBSTR(cElapsed, 4, 2))*(60) + VAL(SUBSTR(cElapsed, 7, 2))
lExpired := nElapsed > nTimeOut
EndDo
The above code has met my needs and ensures the execution attempts respecting the nTimeOut
past. OK.
I wonder if there’s a more elegant or optimized to rewrite the line:
nElapsed := VAL(SUBSTR(cElapsed, 1, 2))*(3600) + VAL(SUBSTR(cElapsed, 4, 2))*(60) + VAL(SUBSTR(cElapsed, 7, 2))
Considering all the cost of dismembering the cElapsed
in hour, minute and seconds, turn them into seconds and add them up to finally compare with the nTimeOut
.