[SNMP4J] Convert long to int?

PHIL BERGSTRESSER phil.bergstresser at adtran.com
Tue Jun 5 00:39:51 CEST 2007


Frank,
    I think this is begging the question. There is an SMIv2 RFC
definition for TimeTicks:

-- hundredths of seconds since an epoch
TimeTicks ::=
    [APPLICATION 3]
        IMPLICIT INTEGER (0..4294967295)

    This requires a long to be represented in Java. Your constructor
requires a long which is consistent with that, so I don't know why Joel
is having a problem.
    What he uses it for is not relevant.
Phil

> -----Original Message-----
> From: snmp4j-bounces at agentpp.org 
> [mailto:snmp4j-bounces at agentpp.org] On Behalf Of Frank Fock
> Sent: Monday, June 04, 2007 5:24 PM
> To: jtgoguen at gmail.com
> Cc: snmp4j at agentpp.org
> Subject: Re: [SNMP4J] Convert long to int?
> 
> Hi Joel,
> 
> As the name "TimeTicks" suggests, this type is NOT designed 
> to hold a time value. To hold a time value, use the 
> DateAndTime textual convention.
> 
> Best regards,
> Frank
> 
> Joel Goguen wrote:
> > I'm having some trouble creating a TimeTicks object.  The 
> constructor 
> > says to pass a long value, which I'm doing by calling 
> > System.currentTimeMillis(), which is required since the device 
> > receiving my traps displays the TimeTicks field as the 
> current system 
> > time.  However, when I pass this long value to TimeTicks, I get an 
> > IllegalArgumentException, since the current system time is greater 
> > than 2^32 - 1.  Is there any way to convert a long to fit into 
> > TimeTicks that would preserve the current system time?
> > 
> 
> -- 
> AGENT++
> http://www.agentpp.com
> http://www.mibexplorer.com
> http://www.mibdesigner.com
> 
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
> 



More information about the SNMP4J mailing list