chrome://webrtc-internal stats 中使用的时区是什么?

What is the timezone used in chrome://webrtc-internal stats?

我一直在分析使用chrome://webrtc-internal生成的JSON文件,而运行webrtc。 我试图在以下结果中找到 startTime 的匹配时区:

'RTCVideoSource_6-width': {
    'startTime': '2021-04-14T07:09:33.163Z',
    'endTime': '2021-04-14T07:14:12.161Z',
    'values': '[1920,1920,1920,1920,1920,1920,1920,1920,1920]'},

我尝试使用 UTC 时区在我的时区中找到相应的时间戳,但没有成功。

yourdate = dateutil.parser.parse(RTCVideoSource_6-width['startTime'])
startTime_utc = yourdate.replace(tzinfo=pytz.UTC)
startTime_hk=startTime_utc.astimezone(pytz.timezone("Asia/Hong_Kong")) #astimezone method
#since 1970
startAge_utc = datetime.datetime(1970,1,1).replace(tzinfo=pytz.UTC)
startAge_hk=startAge_utc.astimezone(pytz.timezone("Asia/Hong_Kong")) #astimezone method
start_in_seconds = int((startTime_hk- startAge_hk).total_seconds())

当我将now()作为时间戳以秒为单位进行比较时,得到的值相差比较大, 16183841731618383543.

chrome://webrtc-internal stats 中使用的时区是什么? 我的转换方法正确吗?

参见ISO8601: you have UTC date/time (Z = zulu = UTC). See How do I parse an ISO 8601-formatted date? how to parse. Unix time (seconds since 1970-01-01) on the other hand always (should) refer to UTC (e.g. startTime_utc and startTime_hk must give the same timestamp!). Note: datetime objects have a timestamp方法。

EX:

from datetime import datetime
from zoneinfo import ZoneInfo # Python 3.9+

d = {'startTime': '2021-04-14T07:09:33.163Z',
     'endTime': '2021-04-14T07:14:12.161Z',
     'values': '[1920,1920,1920,1920,1920,1920,1920,1920,1920]'}

startTime_utc = datetime.fromisoformat(d['startTime'].replace('Z', '+00:00'))
print(repr(startTime_utc))
# datetime.datetime(2021, 4, 14, 7, 9, 33, 163000, tzinfo=datetime.timezone.utc)
print(startTime_utc.timestamp())
# 1618384173.163 

startTime_HK = startTime_utc.astimezone(ZoneInfo('Asia/Hong_Kong'))
print(repr(startTime_HK))
# datetime.datetime(2021, 4, 14, 15, 9, 33, 163000, tzinfo=zoneinfo.ZoneInfo(key='Asia/Hong_Kong'))
print(startTime_HK.timestamp())
# 1618384173.163