[whatwg] Timing API proposal for measuring intervals

James Robinson jamesr at google.com
Tue Aug 16 19:08:10 PDT 2011

The discussion of audio concerns seems to have died down.  I think anything
specific to audio will be additive to this API, and there are still several
non-audio use cases, so here's an updated proposal:

double window.performance.now();

The idea of putting it on window.performance is that this seems closely
related to the UserTiming spec currently under development by the Web Perf
working group (
 When window.performance.now() is called, the browser returns a double
representing the number of milliseconds that have elapsed since the most
recent top-level navigation in that context.  That's the same time value
that is used by the navigation and user timing specs.  Defining this as a
function instead of an attribute makes it clearer that the returned value
can change on every access and is not fixed while script is running.  This
is important for the script profiling use case.  When a fixed time value is
needed, as for example in requestAnimationFrame, it should be provided by
that API.  By putting this on window.performance, we can pick a nice short
function name without having to worry so much about potential collisions
with existing content.

- James

More information about the whatwg mailing list