By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,917 Members | 1,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,917 IT Pros & Developers. It's quick & easy.

Javascript can get time, can it get milliseconds, or actually just tenths of seconds?

P: n/a
Guy
JavaScript can get time, can it get milliseconds, or actually just tenths of
seconds?
Thanks for all
Guy
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Lee
Guy said:

JavaScript can get time, can it get milliseconds, or actually just tenths of
seconds?


It depends on the machine it's running on.
It reports the value in milliseconds, but the value that
it receives from the operating system is rarely, if ever
that precise.

Jul 20 '05 #2

P: n/a
JRS: In article <y7*******************@ursa-nb00s0.nbnet.nb.ca>, seen
in news:comp.lang.javascript, Guy <so*****@somewhere.nb.ca> posted at
Fri, 5 Dec 2003 02:33:02 :-
JavaScript can get time, can it get milliseconds, or actually just tenths of
seconds?


The ECMA-262 language definition strongly implies that it will get no
better than milliseconds, without being quite as explicit as one might
wish.

D = new Date() always AFAIK sets D to an integer, and the routines for
handling dates make no specified allowance for fractional milliseconds.

In DOS..Win98 browsers, the time changes exactly 0x1800B0 times per 24
nominal hours, which is near 18.2 Hz or 54.9 ms. But the conversion is
to a multiple of 10 ms, so going up 50 or 60 ms each time.

In WinNT browsers, I believe that there are 10 ms steps.

Details for other systems would be welcome.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.