Re: DOMTimeStamp interface not defined in L3 events...

On Sun, 4 Oct 2009, Jacob Rossi wrote:
> >
> > Can't you do
> >
> >  var jsdate = new Date(e.timeStamp);
> >
> > ...? (Might need a factor of 1000 multiplier.)
> 
> Doesn't work for me. Test page:   http://www.jacobrossi.com/eventdates.html
> 
> In Firefox,
> The value of e.timeStamp *looks* like a UNIX timestamp (milliseconds
> since Jan. 1, 1970 midnight), which is what MDC documentation led me
> to believe it should be. However, it's not a correct timestamp and is
> not off by a simple factor of 1000 or something. Further, trying to
> convert an example of a HTML5 "valid date and time string" using the
> date.parse does not work.

Ah, in Firefox, at least on Mac, it's the number of milliseconds since the 
computer was last restarted.

The above works in Safari.


> I think using a JS date object makes the most sense (especially since 
> it's easy to go from a date object to either a date/time string OR unix 
> timestamp). But if there are sites that expect this to be unix timestamp 
> or date string, then this would break them.

Well it depends what the use case is. If the use case is just to be able 
to tell the relative time between events, Firefox's behaviour is fine. Why 
do you want Date objects?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Sunday, 4 October 2009 21:44:06 UTC