W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2009

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

From: Jacob Rossi <rossi@gatech.edu>
Date: Sun, 4 Oct 2009 23:36:10 -0400
Message-ID: <b1dbfad70910042036j1225dffbua5c00ae33abf96e2@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: annevk@opera.com, www-dom@w3.org, travil@microsoft.com
Either a date object or milliseconds since the epoch is fine since the
date() function makes it easy to move between formats. I just wouldn't
like it being a date/time string. But if it's going to be
milliseconds, it should be since the epoch---not since last restart
(particularly if you want to send that timestamp back to the server).

--Jacob



On Sun, Oct 4, 2009 at 5:53 PM, Ian Hickson <ian@hixie.ch> wrote:
> 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 Monday, 5 October 2009 03:37:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:03 GMT