Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: garymc on July 26, 2010, 01:19:45 PM

Title: Milliseconds to Seconds.
Post by: garymc on July 26, 2010, 01:19:45 PM
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'
Title: Re: Milliseconds to Seconds.
Post by: Silent on July 26, 2010, 05:40:40 PM
Attached a screenshot.
Title: Re: Milliseconds to Seconds.
Post by: Silent on July 26, 2010, 05:54:57 PM
Tried a lot but unable to attach any file.  :(

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

Variables                        Function
QStartTime                  TImeStamp[]
hh                            QStartTime/3600000
rem                          QStartTime - (hh*3600000)
mm                            rem/60000
rem                          rem - (mm*60000)
ss                              rem/1000

All variables should be created as Integer type.
Title: Re: Milliseconds to Seconds.
Post by: kubikle on July 28, 2010, 12:02:35 AM
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
Title: Re: Milliseconds to Seconds.
Post by: Kevin S on July 30, 2010, 12:23:01 PM
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.