Skip to content

Instantly share code, notes, and snippets.

@jamesliu96
Created July 3, 2025 10:15
Show Gist options
  • Select an option

  • Save jamesliu96/2b6d4a5476f62c1e5eca5747eeb3ce5b to your computer and use it in GitHub Desktop.

Select an option

Save jamesliu96/2b6d4a5476f62c1e5eca5747eeb3ce5b to your computer and use it in GitHub Desktop.
async function timeOffset(url) {
const t1 = performance.now() + performance.timeOrigin;
const t2 = await (await fetch(url)).text();
const t3 = t2;
const t4 = performance.now() + performance.timeOrigin;
return ((t2 - t1) + (t3 - t4)) / 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment