Question

How to convert time from Timeticks (ASN_TIMETICKS from net-snmp library) to any c++ datetime format? Thx.

Was it helpful?

Solution

Time Ticks are units of 10ms elapsed since the agent last reinitialized; in order to convert to an absolute timestamp, you need to establish a mapping between agent uptime and wall clock time.

Typically, you query sysUptime.0 and note down when the response arrived in order to get the initialization time; you can either do this once at startup and everytime you receive one of the standard traps (cold/warm restart, link up) in order to catch agent restarts, or you include it in the GET request (for GETNEXT, ask for sysUptime, leaving out the instance ID).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top