Does anyone know a workaround for this Chrome error?

So I have the following script:

<HTML><HEAD> <SCRIPT> function alert_minutes() { var d=new Date(); alert ('Minutes past the hour: '+d.getMinutes()); } </SCRIPT> </HEAD><BODY> <button onclick="alert_minutes()">Click Me</DIV> </BODY></HTML> 

And upload it to Chrome. I push the button and she informs me

 Minutes past the hour: 30 

what is right. I speed up my local time by ten minutes, press it again, and he tells me

 Minutes past the hour: 40 

therefore no problem. Now I will return my local time at the right time, click it a third time and it still says

 Minutes past the hour: 40 

I refresh the page, click it for the fourth time, but she still says

 Minutes past the hour: 40 

I close all the Chrome windows and open the browser again, and finally it knows the right time.

So, I conclude: "Without closing or opening the browser, Chrome cannot process the local time set back, only forward." This is not the case when using the same script with Firefox. Does anyone know a workaround for this error? I am using Chrome 16 on Win XP.

+7
source share
3 answers

which is usually the case if chrome uses a monotone clock (e.g. CLOCK_MONOTONIC) to get the time

+1
source
It seems that

is on a five minute interval?

if you move time forward, he says there for about five minutes, even if you move time back, and then update.

explain more, your reason for this function, how important is it? if the time is critical, you should still do the server side.

+1
source

Yep also playable on WinXP

http://jsfiddle.net/X2HeE/2/

 <html> <head> <script type='text/javascript'> function alert_minutes() { var d = new Date(); alert ('Minutes past the hour: ' + d.getMinutes()); } </script> </head> <body> <button onclick="alert_minutes()">Click Me</button> </body> </html> 

I also closed the 'button' tag on the 9th line, instead you closed the 'div' tag, but it wasn’t. The only way to reset the script is to exit the tab process and then open it again.

PS. sorry for my English

0
source

All Articles