JRS: In article <42**********@mk-nntp-2.news.uk.tiscali.com>, dated
Fri, 5 Aug 2005 02:43:59, seen in news:comp.lang.javascript, Stephen
Chalmers <ig******@lycos.co.uk> posted :
exp.setSeconds(exp.getSeconds()+lifeSecs);
Using that purely as an illustration, since the time taken to do it once
is negligible :
K = 40000 ; D = new Date()
D1 = new Date()
J = K ; while (J--) D.setSeconds(D.getSeconds()+1)
D2 = new Date()
J = K ; while (J--) D.setUTCSeconds(D.getUTCSeconds()+1)
D3 = new Date()
J = K ; while (J--) D.setTime(D.getTime()+1000)
D4 = new Date()
J = K ; while (J--) {}
D5 = new Date()
x = [D2-D1, D3-D2, D4-D3, D5-D4]
gives 12140,1210,770,110
The non-UTC function (no doubt because it considers local time) is about
ten times slower than the UTC function, which is about 1.7 times slower
than directly changing the value. In my system.
Javascript will look a bit odd if the M.....s manage to abolish UTC; JS
should have used GMT instead.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.