google-chrome - 您如何使用 Chrome 调试器协议(protocol)从时间戳导出挂墙时间?

标签 google-chrome debugging google-chrome-extension chromium javascript-debugger

我一直在构建一个 Chrome 扩展,部分使用 Chrome debugger protocol .
Network domain 中的某些事件喜欢 requestWillBeSent包括“时间戳”和“wallTime”。

walltime 是自 1970 年以来的常规秒格式,但时间戳以秒为单位,但不清楚它的 0 在哪里,而且许多事件没有 wallTime,所以我真的想弄清楚如何从 timeStamp 派生 wallTime。
基于 this我认为是基于 navigationStart 值,但无论是基于扩展程序 navigationStart 的背景页面还是事件起源于 navigationStart 的页面,都没有产生正确的日期。

是否有可能使用时间戳来获取 wallTime 还是我不走运?

最佳答案

根据 InspectorNetworkAgent.cpp 中的源代码:

  • wallTimecurrentTime() (正常系统时间)
  • timestamp monotonicallyIncreasingTime()

    在 Windows 上,它基于自系统启动以来经过的毫秒数,您无法从扩展中获取该信息。

    在 POSIX 系统上(例如 Linux)clock_gettime在 CLOCK_MONOTONIC 模式下使用表示从某个未指定的起点开始的单调时间。

    根据 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.

  • 关于google-chrome - 您如何使用 Chrome 调试器协议(protocol)从时间戳导出挂墙时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39627245/

    相关文章:

    javascript - 在 46.0 中工作时,getUserMedia 在 chrome 版本 48.0.2560.0 中不起作用

    css - Google Webfonts 在 Firefox、Chrome 和 Opera 中的呈现方式不同

    Xcode 调试器在首次安装应用程序时不起作用

    javascript - Chrome 扩展程序第一次无法运行

    google-chrome - 使背景页面在 Google Chrome 扩展程序中可见

    html - 内容属性应该如何继承到 :before or :after pseudo-element from its container?

    forms - Chrome : Fill out same form many times for testing

    python3快速排序列表索引超出范围

    linux - 直接在 shell 中反汇编操作码片段?

    javascript - Chrome 扩展、追加元素和跨页面更改重新追加