Milliseconds to Seconds.

Hi Guys

I have a integer variable vTime that represents the number of milliseconds a customer spends in a queue, i want to conver that to seconds so i divide by 1000 however i am not getting the expect result for times less than 1000 milliseconds.

_I_I_007601d430635e18 [09:04] ASSIGN: vTime(LOCAL) ← INTEGER: 547
request to 65204(TServer1) message RequestUpdateUserData
AttributeReferenceID 5763
AttributeUserData [18] 00 01 00 00..
‘WaitTime’ ‘547’
AttributeConnID 007601d430635e18
AttributeThisDN ‘4430’
..sent to frwkpri:3000(fd=748)
_I_I_007601d430635e18 [09:04] ASSIGN: vSeconds(LOCAL) ← FLOAT: 0.000000
_I_I_007601d430635e18 [09:04] ASSIGN: vMinutes(LOCAL) ← INTEGER: 0
_I_I_007601d430635e18 [09:04] ASSIGN: vSeconds(LOCAL) ← FLOAT: 0.000000
request to 65204(TServer_KWD) message RequestUpdateUserData
AttributeReferenceID 5764
AttributeUserData [33] 00 01 00 00..
‘TimeSpentInQueue’ ‘0:0.000000’

Attached a screenshot.

Tried a lot but unable to attach any file. :frowning:

Here it is
Use Multi Function or MultiAssign block in IRD:

Variables Function
QStartTime TImeStamp
hh QStartTime/3600000
rem QStartTime - (hh3600000)
mm rem/60000
rem rem - (mm
60000)
ss rem/1000

All variables should be created as Integer type.

1 Like

If you have integer variable and divide it by 1000 (integer constant) then URS performs integer ariphmetic before asigning result. You could try to delete it by something like 1000.0

1 Like

Agree with kubikle.
You might get the same result if you stored the wait time into a FLOAT before you started your calculations.
Either way, if you try Integer divided by Integer, you’re going to lose the decimal part of your result. But if you try INT/FLOAT or FLOAT/INT, you should succeed.

1 Like