ID:1952489
 
Heya, so I wrote an extremely accurate timer script to help me on a science project.

This is my stopwatch code:

    var/script = {"

<!DOCTYPE html>
<html>
<head>

<script>

var Timer =
[];
Timer
["StopWatch"] = 0;
Timer
["LoadingTime"] = 0;


function StartTime(){
Timer
["LoadingTimer"] = performance.now();
}

function EndTime(){
Timer
["StopWatch"] = performance.now();
var DiffTime = Timer
["StopWatch"] - Timer["LoadingTime"];
alert(DiffTime);
}

</script>
</head>
<body>
<button onclick="StartTime()">StartTimer</button>
<button onclick="EndTime()">EndTimer</button>
</body>
</html>

"}


The performance.now is a new javascript feature that outputs the time that has passed since the page loaded. The performance.now is extremely accurate (up to microseconds precision).


My problem is:

How can I start the stopwatch both on my computer number 1 and computer number 2 at the same exact time (using javascript/jquery)?

I thought of setting an UTC based alarm system on both the computers that would start the stopwatch but I am not sure if it is accurate enough...
Thanks in advance

It's a bit of a crap approach, [but would allow you to avoid using PHP] you could have jquery scan a certain page (like a text file) and only start the clock when it reads some sort of trigger phrase/word on the page. You would have to make sure it is set and reset each time though [manually].
Are you attempting to do all of this web-browser only? Or are you utilizing DM as well?
Web browser only.

I think that your suggestion might work... I could make both the computers start the stopwatch with a trigger word. Then I would calculate the computer A and B response time (the time between the moment when the computer reads the trigger word and the moment that it actually reacts to it) to keep the results accurate.