W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2009

Stopwatch interval timer

From: Mike Belshe <mbelshe@google.com>
Date: Wed, 25 Feb 2009 15:08:16 -0800
Message-ID: <bccec9d80902251508sef3a6bdu689645b0ad8a9331@mail.gmail.com>
To: public-webapps@w3.org
Cc: Ian Hickson <ianh@google.com>, Darin Fisher <darin@google.com>
For debugging performance in Chrome we wrote a high-res stopwatch API.
 Specifically, we needed to measure sub-millisecond times.  Currently there
is no mechanism for a javascript application to access fine-grained timers.
Is there any interest in standardizing something like this?
Here is the basic API we're using.  We are not wed to this API, but we like
it because it is functional, minimalist, and easy to use.  Feedback welcome.

function Interval() {
  // Starts the interval timer
  // If already started, restarts the start time.
  this.start = function() {}

  // Stops the interval timer.
  // If the timer has not been started, has no effect
  // If the timer has already been stopped, resets the stop time to now.
  this.stop = function() {}

  // Get the measured interval in microseconds.
  // If the timer was started, but not stopped, gets the time since it was
  // Otherwise returns the difference between the stop and start times.
  this.microseconds = function() {}


Mike Belshe
Received on Thursday, 26 February 2009 07:39:58 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:14 UTC