Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将时间从 Timeticks(来自 net-snmp 库的 ASN_TIMETICKS)转换为任何 c++ 日期时间格式?谢谢。
Time Ticks 是自代理上次重新初始化以来经过的 10 毫秒单位;为了转换为绝对时间戳,您需要在代理正常运行时间和挂钟时间之间建立映射。
通常,您查询sysUptime.0并记下响应何时到达以获得初始化时间;您可以在启动时执行此操作一次,并且每次收到标准陷阱之一(冷/热启动、链接)以捕获代理重新启动,或者将其包含在 GET 请求中(对于 GETNEXT,请求sysUptime,省略实例 ID)。
sysUptime.0
sysUptime