w3c / navigation-timing

Navigation Timing
https://w3c.github.io/navigation-timing/
Other
116 stars 30 forks source link

Relationship between performance.timing.navigationStart and hr-time time origin #43

Closed majido closed 8 years ago

majido commented 8 years ago

Based on my reading of the spec performance.timing.navigationStart seems to be the same as time origin as specified in hr-time spec. The wording is not exactly the same so I may be mistaken.

If my interpretation is correct then I think we should spell this relationship explicitly in this spec and perhaps align the texts. Otherwise, I think they should be made the same. :)

hr-spec definition

If the global object [HTML51] is a Window object, the time origin must be equal to:

This attribute must return the time immediately after the user agent finishes prompting to unload the previous document. If there is no previous document, this attribute must return the time the current document is created.

where current document = Window object's newest Document object.

igrigorik commented 8 years ago

Hmm, conceptually, yes.. Only gotcha is that PerformanceTiming is a legacy interface which predates our time origin definition in HR-Time. That said, I guess we're not planning to deprecate it, and since it's pretty much aligned, perhaps we can simplify it.

navigationStart

This attribute must return the time origin of the Window object.

@plehegar @toddreifsteck wdyt?

toddreifsteck commented 8 years ago

I agree with @igrigorik 's suggestion.

plehegar commented 8 years ago

performance.timing.navigationStart is part of the historical section of the spec. That section starts with: "All time values defined in this appendix are measured in milliseconds since midnight of January 1, 1970 (UTC)."

Thus the description says "If there is no previous document, this attribute must return the time the current document is created."

Note that the equivalent in PerformanceNavigationTiming is the startTime, which is always equal to 0: https://w3c.github.io/navigation-timing/#dom-PerformanceNavigationTiming-startTime

We should do better at marking that section as historical. Folks shouldn't look at the historical if they're looking at using the L2 but we still need to keep it there for legacy.

plehegar commented 8 years ago

See https://www.w3.org/2016/05/04-webperf-minutes.html#item05

igrigorik commented 8 years ago

Here's my attempt..

image

#historical {
    background-position: right;
    background-repeat: repeat-y;
    background-color: rgba(251, 233, 233, 0.5);
    background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='150px' width='50px'><text x='0' y='50' fill='red' font-size='30' fill-opacity='0.20'>L1</text></svg>");
}

@plehegar @toddreifsteck any objections?

plehegar commented 8 years ago

belated +1 on this one. Nice result!