How to convert time from Timeticks (ASN_TIMETICKS from net-snmp library) to any c++ datetime format? Thx.
Asked
Active
Viewed 1,783 times
1 Answers
2
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).

Simon Richter
- 28,572
- 1
- 42
- 64