开发者

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 t开发者_运维技巧imestamp.

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜