Convert 64-bit UTC timestamp to Actionscript date

I am using a 64-bit UTC time representation in the UTC format System.currentTimeInMillis () and sending it to the ActionScript client as a String, and I want to convert the Actionscript Date to UTC .

The problem is that ActionScript (and another ECMAScript such as Javascript) uses only the 64-bit representation of floating-point numbers, so accuracy is lost when converting a 64-bit timestamp.

I could create my own long class and manipulate the upper and lower bits and convert a date like this (but with all these efforts, I can also send a string with a formatted date that I can call using Date.parse ()).

+3
source share
1 answer

If you really have no reason to improve performance, use String (you use ActionScript, so there is almost certainly not). This will be more obvious, less error prone and easier to debug if you need to watch messages on a wire.

+1
source

Source: https://habr.com/ru/post/1723498/


All Articles