Did a bit of searching and came up with this:
Code:
<script type="text/javascript">
function secondize(n)
{
if (n!=0)
{
n= n / 1000;
}
return n;
}
var timer = {
init: function() {
this.startTime = (new Date()).getTime();
return this;
},
stop: function() {
// returns time difference (in seconds: getSeconds()) between start time and time that this function was called
var difference = new Date();
var timeUsed=secondize(difference.setTime((new Date().getTime()) - this.startTime));
return timeUsed;
}
};
var count = timer.init();
</script>