Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RokuKC
Roku Employee
Roku Employee

Re: Timestamp in milliseconds

Please see the info that I provided above. 

The point is that to avoid overflow the calculations need to be made with LongInteger values rather than Integer values.

In a calculation with 2 Integer values (+, -, *, /, \, Mod) the result will also be an Integer value.

However if one or both of the values is a LongInteger, the calculation and value will be a LongInteger value.

totalMilliSeconds = (seconds * 1000) + milliSecondsPart

^ This calculation is done with all Integer (32-bit) values, so will overflow with large values.

totalMilliSeconds = (seconds * 1000&) + milliSecondsPart

If you do this instead, the "1000&" denotes a LongInteger (64-bit) constant, which promotes the calculation to be done in that extended range, so it should not overflow.

https://developer.roku.com/docs/references/brightscript/language/expressions-variables-types.md#nume...

Hope that helps!

0 Kudos