I apologize for being an idiot. The answer is was looking for 'use a
'double' instead of a 'long' - you said it yourself - dumbass!'.

Eh, it had been a long day. Thanks for all the hints, at any rate. And
extra points for Ian for showing yet another way in which JSOs are
cool.

On Aug 29, 9:26 am, "Ian Petersen" <[EMAIL PROTECTED]> wrote:
> On Fri, Aug 29, 2008 at 3:05 AM, Reinier Zwitserloot <[EMAIL PROTECTED]> 
> wrote:
> > I don't use GWT-Serialization to talk to my server. The server sends
> > timestamps as milliseconds. I'd like to turn these milliseconds into
> > javascript Date objects.
>
> > How do I accomplish this?
>
> > As I mentioned when long emulation was on the table, timestamps are
> > one of those numbers which are not representable with ints, but they
> > fit perfectly in the range where doubles still represent integral
> > numbers without loss of precision.
>
> I don't think you want to use longs--someone measured them at 250
> times slower than JS doubles, or something like that.  I think you
> want the following:
>
> public final class JSDate extends JSO {
>
>   protected JSDate() {
>   }
>
>   public static native create(double millis) /*-{
>     return new Date(millis);
>   }-*/;
>
>   // implement relevant date methods here, like getYear:
>
>   public native int getYear() /*-{
>     return this.getYear();
>   }-*/;
>
> }
>
> Not sure though--I haven't used the new overlay stuff myself, and I
> typed the above directly into the browser without testing.
>
> Ian
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to