W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2011

[whatwg] Timing API proposal for measuring intervals

From: James Robinson <jamesr@google.com>
Date: Tue, 16 Aug 2011 19:08:10 -0700
Message-ID: <CAD73mdLKUMT3Jj1g53_gctvn64Qn6t2OOcp2evyNipuA1o62Zg@mail.gmail.com>
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 (
http://w3c-test.org/webperf/specs/UserTiming/#the-usertiming-interface).
 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
Received on Tuesday, 16 August 2011 19:08:10 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:35 UTC