My VerifyOnServ(nTimeOut)
, is not always obeying nTimeOut
passed, either because of it or the server with which it communicates.
Then I needed an insistence on its execution obeying nTimeOut
Follow 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 code above has met my needs and guarantees that the execution attempts will be respecting the nTimeOut
passed. OK.
I would like to know if there is a better smart or optimized mode to rewrite the line:
nElapsed := VAL(SUBSTR(cElapsed, 1, 2))*(3600) + VAL(SUBSTR(cElapsed, 4, 2))*(60) + VAL(SUBSTR(cElapsed, 7, 2))
Given the full cost of breaking down cElapsed
in hour, minute, and seconds, turn them into seconds and add them to finally compare with nTimeOut
.