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

问题描述

我一直在使用部分 Chrome调试器协议来构建Chrome扩展程序.网络域中的某些事件,例如 requestWillBeSent 包含时间戳记"和"wallTime".

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?

推荐答案

根据 InspectorNetworkAgent.cpp :

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

在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 :

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

09-09 23:32