[SNMP4J] sysUpTime units doc example.

Frank Fock fock at agentpp.com
Sun Aug 31 18:54:34 CEST 2014


Hi,

Yes, this the example should read as follows:

long sysUpTime = (System.nanoTime() - startTime) / 10000000 // 10^-7

I will fix the documentation (that was a regression when replacing
System.currentMillis() with System.nanoTime().

Best regards,
Frank

Am 31.08.2014 15:37, schrieb Mooli Tayer:
> Anything about this?
>
> ----- Original Message -----
>> *******************************************************************************
>>
>> Hi,
>>
>> At the org.snmp4j[1] Package documentation There is the following
>> example:
>>
>> // sysUpTime
>> long sysUpTime = (System.nanoTime() - startTime) / 10000;
>> pdu.add(new VariableBinding(SnmpConstants.sysUpTime, new
>> TimeTicks(sysUpTime)));
>>
>>
>> Here the unites are 10^-9 / 10^5 = 10^-4 but according to docks[2]
>> is seems[3] we need to devide by 10000000 to get 10^-2 (a 100th of a second)
>>
>> Testing locally I saw that:
>> (System.nanoTime() - nanoStart) / 10000000)
>> gives:
>> DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2333) 0:00:23.33
>>
>> For several seconds.
>>
>> Please advise how this should be done and if there might be an error
>> in the example.
>>
>>
>> [1] http://www.snmp4j.org/doc/org/snmp4j/package-summary.html
>> [2] http://www.snmp4j.org/doc/org/snmp4j/smi/TimeTicks.html
>> [3] it does not state what the long units are but it states:
>> "The TimeTicks class represents the time in 1/100 seconds since some
>> epoch..."
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://oosnmp.net/mailman/listinfo/snmp4j

-- 
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231




More information about the SNMP4J mailing list