You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As requested in #50
A function to create several Timers
function Timer() {
var started = null;
var stopped = null;
this.start = function() {
started = new Date();
};
this.stop = function() {
stopped = new Date();
var timetaken = (stopped.getTime() - started.getTime()) / 1000;
return timetaken;
};
}
The usage would be like this:
// the delay function is just for testing
function delay(prmSec) {
prmSec *= 1000;
var eDate = null;
var eMsec = 0;
var sDate = new Date();
var sMsec = sDate.getTime();
do {
eDate = new Date();
eMsec = eDate.getTime();
} while ((eMsec - sMsec) < prmSec);
}
// usage
var duration = new Timer();
duration.start();
delay(1.456);
$.writeln(duration.stop());
The text was updated successfully, but these errors were encountered:
As requested in #50
A function to create several Timers
The usage would be like this:
The text was updated successfully, but these errors were encountered: