Date.prototype.getTime

Bob Ippolito bob at redivi.com
Tue Jun 27 18:51:50 PDT 2006


On Jun 27, 2006, at 6:34 PM, 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.
>
>> 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() isn't part of the standard... or if it is, it's not  
consistently implemented.

-bob




More information about the Es4-discuss mailing list