" /> Milliseconds to Seconds. - Genesys CTI User Forum

Author Topic: Milliseconds to Seconds.  (Read 2604 times)

Offline garymc

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Milliseconds to Seconds.
« on: July 26, 2010, 01:19:45 PM »
Advertisement
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'

Offline Silent

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Milliseconds to Seconds.
« Reply #1 on: July 26, 2010, 05:40:40 PM »
Attached a screenshot.

Offline Silent

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Milliseconds to Seconds.
« Reply #2 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.

Offline kubikle

  • Full Member
  • ***
  • Posts: 140
  • Karma: 7
Re: Milliseconds to Seconds.
« Reply #3 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

Offline Kevin S

  • Full Member
  • ***
  • Posts: 145
  • Karma: 4
Re: Milliseconds to Seconds.
« Reply #4 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.