Date.prototype.getTime

Brendan Eich brendan at mozilla.org
Wed Jun 28 09:12:26 PDT 2006


On Jun 28, 2006, at 3:10 AM, P T Withington wrote:

> On 2006-06-27, at 23:32 EDT, Bob Ippolito wrote:
>
>> Why not a (64-bit) float? Millisecond precision is pretty weak,  
>> it'd be nicer to have higher precision where available and a float  
>> is the only reasonable way to get it (since nanoseconds don't fit  
>> well in a 32-bit integer).
>
> My point exactly.  Even in an interpreter, 1ms is a looong time  
> these days.  And floats are no longer expensive.
>
> Adding something like Date.now() would make optimization easier for  
> implementers (might translate to only a few instructions on a  
> decent architecture, e.g., scale the cycle-count register by the  
> system clock frequency).

The "not ready for public review" section of http:// 
developer.mozilla.org/es4/proposals/proposals.html contains a http:// 
developer.mozilla.org/es4/proposals/date_and_time.html link that  
dangles presently.  In the wiki, it contains a sketchy list:

* Support properties for the get/set method pairs.

* Add ISO 8601 Date format support.

* Add Date.now() as a standard way to get the time in milliseconds  
since the epoch.

* A year from the epoch in nanoseconds requires more mantissa bits  
than are in IEEE754 double. Return a pair [seconds, nanoseconds] from  
a Date.nanotime() static method.

/be




More information about the Es4-discuss mailing list