Date.prototype.getTime
P T Withington
ptw at pobox.com
Tue Jun 27 18:56:40 PDT 2006
On 2006-06-27, at 21:34 EDT, Jeff Walden wrote:
> P T Withington wrote:
>> I am wondering if the new standard should encourage implementors
>> to return a value with as much precision as the underlying
>> hardware/OS permits?
>
> I would assume this doesn't really need to be specified and will be
> assumed by implementers (at worst in response to user demands) as
> much as is practical, but then again, I've never spec'd or
> implemented a programming language.
In my experience, 'advice to the implementor' is important. It's non-
binding, but it's useful to record.
>> Or, is there already a better, more accurate way to measure
>> elapsed time? Or, should there be?
>
> I was under the impression that the following was more idiomatic,
> but I could be wrong:
>
>> var before = Date.now();
>> doStuff();
>> var after = Date.now();
>> var elapsedTime = after - before;
Date.now() makes lots of sense! Why can't I find that in ECMA 262-3
spec? Is this a Mozilla extension? I don't see it in ActionScript
either...
More information about the Es4-discuss
mailing list