0

I am trying to retrieve the epoch time for when a request is made to a server requestStart from the Mdn docs. I could've easily done this with window.performance.timing ; however, timing is now depreciated shown here.

This is the target data shown in epoch time using the depreciated performance.timing :

connectEnd: 1681158191016
connectStart: 1681158190760
domComplete: 1681158198077
domContentLoadedEventEnd: 1681158197612
domContentLoadedEventStart: 1681158197596
domInteractive: 1681158197596
domLoading: 1681158192909
domainLookupEnd: 1681158190760
domainLookupStart: 1681158190760
fetchStart: 1681158190644
loadEventEnd: 1681158198078
loadEventStart: 1681158198078
navigationStart: 1681158190622
redirectEnd: 0
redirectStart: 0
requestStart: 1681158191016 // needed value correct format
responseEnd: 1681158192980
responseStart: 1681158192893
secureConnectionStart: 1681158190836
unloadEventEnd: 1681158192902
unloadEventStart: 1681158192902

And when I use the interface that it recommended PerformanceNavigationTiming using the docs

window.performance.getEntriesByType("navigation")[0]

I get the following response:

...
duration: 7455.199999988079
encodedBodySize: 22998
entryType: "navigation"
fetchStart: 21.19999998807907
initiatorType: "navigation"
loadEventEnd: 7455.199999988079
loadEventStart: 7454.900000035763
name: ""
nextHopProtocol: ""
redirectCount: 0
redirectEnd: 0
redirectStart: 0
renderBlockingStatus: "non-blocking"
requestStart: 393.30000001192093 // needed value incorrect format
responseEnd: 2357.900000035763
responseStart: 2270.199999988079
...

So I was just wondering how can I get the window performance to return epoch timing for the PerformanceNavigationTiming interface? Thanks

I tried window.performance.getEntriesByType("navigation")[0] and got the wrong time stamps that were relative

Anon211
  • 27
  • 7

0 Answers0