Dougnukem
Dougnukem

Reputation: 14917

Converting a 64-bit long UTC timestamp into Actionscript Date

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() ).

Upvotes: 3

Views: 1807

Answers (1)

Alastair Maw
Alastair Maw

Reputation: 5492

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.

Upvotes: 1

Related Questions