{"action":"created","issue":{"url":"https://api.github.com/repos/w3c/hr-time/issues/22","repository_url":"https://api.github.com/repos/w3c/hr-time","labels_url":"https://api.github.com/repos/w3c/hr-time/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/w3c/hr-time/issues/22/comments","events_url":"https://api.github.com/repos/w3c/hr-time/issues/22/events","html_url":"https://github.com/w3c/hr-time/issues/22","id":117996219,"number":22,"title":"Translating high resolution timestamps between globals","user":{"login":"annevk","id":1544111,"avatar_url":"https://avatars.githubusercontent.com/u/1544111?v=3","gravatar_id":"","url":"https://api.github.com/users/annevk","html_url":"https://github.com/annevk","followers_url":"https://api.github.com/users/annevk/followers","following_url":"https://api.github.com/users/annevk/following{/other_user}","gists_url":"https://api.github.com/users/annevk/gists{/gist_id}","starred_url":"https://api.github.com/users/annevk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/annevk/subscriptions","organizations_url":"https://api.github.com/users/annevk/orgs","repos_url":"https://api.github.com/users/annevk/repos","events_url":"https://api.github.com/users/annevk/events{/privacy}","received_events_url":"https://api.github.com/users/annevk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/w3c/hr-time/labels/privacy","name":"privacy","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":61,"created_at":"2015-11-20T09:00:48Z","updated_at":"2016-06-03T23:41:12Z","closed_at":null,"body":"_Note (igrigorik), original title: \"**translateTime does not work for nested workers**\"_\r\n\r\nThrough `MessageChannel` a document can directly communicate with a worker that it otherwise knows nothing about. `translateTime` doesn't really work with that existing capability model."},"comment":{"url":"https://api.github.com/repos/w3c/hr-time/issues/comments/223719514","html_url":"https://github.com/w3c/hr-time/issues/22#issuecomment-223719514","issue_url":"https://api.github.com/repos/w3c/hr-time/issues/22","id":223719514,"user":{"login":"sicking","id":1831914,"avatar_url":"https://avatars.githubusercontent.com/u/1831914?v=3","gravatar_id":"","url":"https://api.github.com/users/sicking","html_url":"https://github.com/sicking","followers_url":"https://api.github.com/users/sicking/followers","following_url":"https://api.github.com/users/sicking/following{/other_user}","gists_url":"https://api.github.com/users/sicking/gists{/gist_id}","starred_url":"https://api.github.com/users/sicking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sicking/subscriptions","organizations_url":"https://api.github.com/users/sicking/orgs","repos_url":"https://api.github.com/users/sicking/repos","events_url":"https://api.github.com/users/sicking/events{/privacy}","received_events_url":"https://api.github.com/users/sicking/received_events","type":"User","site_admin":false},"created_at":"2016-06-03T23:41:12Z","updated_at":"2016-06-03T23:41:12Z","body":"per-origin is probably not acceptable, since we'll have situations where google.com and youtube.com will want to collaborate on measuring timing.\r\n\r\nBut do note that there is an alternative proposal. Which is that we create an opaque object which you can stick a timestamp into. You can then transfer that opaque object to another global using postMessage. The object then has a getter which enables extracting a timestamp and which automatically translates the timestamp to the new global timeline.\r\n\r\nThat is option `2` from [this comment](#issuecomment-220085052).\r\n\r\nThe main downside with this solution is API awkwardness if you're transferring lots of timestamps.\r\n\r\n\r\nThough it occurs to me that there is a simpler version of that solution.\r\n\r\nImagine that we expose a `TimelineOffset` constructor. Calling `new TimelineOffset` returns an object with a single function `.get()`. When called, it returns the timeline delta between the current global, and the global in which the object was created.\r\n\r\nSo `(new TimelineOffset()).get()` always returns 0.\r\n\r\nBut calling\r\n```javascript\r\nx = new TimelineOffset();\r\nsomeplace.postMessage({ offset: x,\r\n                        timeStamps: [a, b, c],\r\n                        entries: performance.getAllTheEntries()});\r\n```\r\nAllows you to transfer a bunch of local time information, as well as a single object that allows all of that time information to be translated by the receiver.\r\n"}}
{"actor":{"display_login":"sicking"}}