您如何使用Chrome的调试器协议从时间戳推导出Walltime? [英] How do you derive walltime from timestamp using Chrome's debugger protocol?

查看:158
本文介绍了您如何使用Chrome的调试器协议从时间戳推导出Walltime?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用部分 Chrome调试器协议来构建Chrome扩展程序. 网络域中的某些事件,例如

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."

walltime是自1970年格式以来的常规秒数,但是时间戳以秒为单位,但尚不清楚其0的位置,并且许多事件都没有wallTime,因此我真的试图弄清楚如何从timeStamp导出wallTime. 基于,我相信是基于navigationStart值,但基于扩展程序的navigationStart的背景页面或事件源自navigationStart的页面,得出的日期都不正确.

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.

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

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

推荐答案

根据

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

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

    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.

    在POSIX系统(例如Linux)上,处于CLOCK_MONOTONIC模式的clock_gettime表示从某个未指定的起点开始的单调时间.

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

    根据 time.h :

    TimeTicks和ThreadTicks表示大部分时间中的抽象时间 增量,用于测量持续时间.在内部,它们是 以微秒为单位. 它们不能转换为人类可读的 时间,但保证不会减少(与Time类不同).注意 TimeTicks可能会静止不动"(例如,如果计算机已挂起),并且 每当线程被调度时,ThreadTicks将静止" 操作系统.

    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.

  • 这篇关于您如何使用Chrome的调试器协议从时间戳推导出Walltime?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆