4

I've been building a Chrome extension using in part the Chrome debugger protocol. Certain events in the Network domain like requestWillBeSent include a "timestamp" as well as a "wallTime."

The walltime is a regular seconds since 1970 format, but the timestamp is in seconds but its not clear where its 0 is, and many events have no wallTime so I'm really trying to figure out how to derive wallTime from timeStamp. Based on this I believed to be based on the navigationStart value but that did not yield the correct date based on either the background page of the extension's navigationStart nor the page where the event originated navigationStart.

Is it possible at all to use timestamp to get at the wallTime or am I out of luck?

edibleEnergy
  • 1,739
  • 1
  • 13
  • 15
  • It you have both a `timestamp` and `wallTime` generated at the same time with both using seconds as the quantity measured, then determining the zero reference of that `timestamp` should be trivially obtained by `zeroRef = wallTime - timestamp` (assuming the zero reference for `timestamp` is after that of `wallTime`). If that zero reference can be extended to other instances where you have a time stamp will depend on if the time stamps have the same reference. We can not comment upon this because you have not stated which functions you are talking about and *how you are using them*. – Makyen Sep 21 '16 at 22:36

1 Answers1

7

According to source code in InspectorNetworkAgent.cpp:

  • wallTime is currentTime() (normal system time)
  • timestamp is monotonicallyIncreasingTime()

    On Windows it's based on the number of milliseconds that have elapsed since the system was started, and you can't get that info from an extension.

    On POSIX systems (e.g. Linux) clock_gettime in CLOCK_MONOTONIC mode is used that represents monotonic time since some unspecified starting point.

    According to source code in time.h:

    TimeTicks and ThreadTicks represent an abstract time that is most of the time incrementing, for use in measuring time durations. Internally, they are represented in microseconds. They can not be converted to a human-readable time, but are guaranteed not to decrease (unlike the Time class). Note that TimeTicks may "stand still" (e.g., if the computer is suspended), and ThreadTicks will "stand still" whenever the thread has been de-scheduled by the operating system.

wOxxOm
  • 65,848
  • 11
  • 132
  • 136
  • Awesome thanks! So the answer (I'll leave this unmarked as *the* answer for a day in case someone disagrees ) is my backup plan: find an event with both and use that to index what the wallTime is from that timestamp. – edibleEnergy Sep 22 '16 at 17:30