Lars T Hansen
lth at opera.com
Fri Jun 30 00:53:50 PDT 2006
Jeff Walden writes:
> 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.
The spec states clearly (188.8.131.52) that time is measured in
milliseconds. Furthermore, new Date(v) performs TimeClip on v to
transform v to milliseconds, and new Date(,,,,,,ms) converts ms to
integer. Clearly, for all practical purposes no portable program can
assume that time measured by the Date object is anything but an
integer number of milliseconds.
The question is perhaps whether a portable program can assume that
time is always a number of milliseconds. This seems less clear, but
it seems to be strongly implied.
That being so, an implementation choosing to support greater precision
for time risks breaking portable programs since the external
representation of a time value is not as expected, ie, programs that
expect integers in the external representation of time values may find
Programs that only use Date to obtain timestamps that are always
represented internally as numbers are probably not at much risk,
(Speaking as one of the implementors, I've never considered the option
of representing time to a finer precision than milliseconds.)
More information about the Es4-discuss