Closed ingararntzen closed 9 years ago
Additionally, the interface between TimingProvider and TimingObject needs to be explicit about the time unit. The equation (clock_timing_provider = clock_user_agent + skew) requires that all values are expressed in the same unit. Since clock_timing_provider is likely to be epoch in seconds, it would be sensible that skew is expressed in seconds as well. So, I propose that the timing object spec consistently uses seconds as time unit - for skew, for its internal clock and for the timestamps that are exposed through StateVectors.
In accordance with above considerations I've updated the spec to define the internal clock of the timing object to be representing seconds - not milliseconds.
var clock = function () {return performance.now()/1000.0;}
I have also emphasized that all time values mentioned in the spec are seconds, including timestamps in statevectors and skew estimates.
As it stands now, the StateVector is defined to include timestamps sampled from performance.now(), so the value of .timestamp propverty is expressed in milliseconds.
In contrast, velocity and acceleration is expressed in seconds, i.e. unit/second or unit/(second)². This presumably makes more sense for humans. For instance, we are used to media elements measuring offset in seconds, not milliseconds.
As a result, there is inconsistency within the state vector with respect to units. Although this is not a problem from a functional perspective, I still think this looks a bit odd, and it could possibly be a source of confusion?
The alternative would be for timestamps in the StateVector to be expressed in seconds, not milliseconds, i.e. (performance.now() / 1000.0).
A possible downside of this would be that use of vector timestamps with external timing functions, e.g. performance.now(), setTimeout(), setInterval() would require conversion before use. However, having done quite a bit of development with this setup, I don't regard this as much of an issue.
So, I'll simply go ahead and change this is the spec, unless someone has a strong opinion about this.