views:

380

answers:

1

I'm using a Java 64-bit long representation of UTC time System.currentTimeInMillis() and sending that to an Actionscript client as a String, and I want to convert to an Actionscript UTC Date.

The trouble is Actionscript (and other ECMAScript like Javascript) only use a 64-bit Floating point number representation, so precision is lost when converting a 64-bit long timestamp.

I could create my own Long class and manage the upper and lower bits and convert the date like that (but with all that effort I may as well send down a date formatted string that I can call with Date.parse() ).

+1  A: 

Unless you have really pressing performance reasons, use a String (you're using ActionScript, so you almost certainly don't). It will be more obvious, less bug-prone and easier to debug if you need to look at messages on the wire.

Alastair Maw