[SNMP4J] Convert long to int?

Joel Goguen jtgoguen at gmail.com
Tue Jun 5 13:06:57 CEST 2007


I see my mistake now.  Thanks Frank and Phil for pointing this out.

On 6/4/07, PHIL BERGSTRESSER <phil.bergstresser at adtran.com> wrote:
> Thanks for the gracious reply Frank. The rollover for this clock time is
> about 497 days and was originally used to define sysUptime which was
> probably plenty when it was originally defined. Now with Counter64  we
> could take it to infinity, but that's not possible to change now.
>
> I misinterpreted Joel's question to be about the argument type, but I
> see now it was about the argument value, which he clearly pointed out.
> We have had to deal with date and time as strings as you pointed out and
> not use timeticks for such information.
>
> Sorry for the thoughtless diversion.
>
> Phil
>
>
> > -----Original Message-----
> > From: Frank Fock [mailto:frank.fock at t-online.de]
> > Sent: Monday, June 04, 2007 6:15 PM
> > To: PHIL BERGSTRESSER
> > Cc: jtgoguen at gmail.com; snmp4j at agentpp.org
> > Subject: Re: [SNMP4J] Convert long to int?
> >
> > Hi Phil,
> >
> > The problem is, the System.currentTimeMillis() returns milli seconds
> > (1/1000s) and TimeTicks uses hundredths of seconds (1/100).
> > The factor 10 makes the difference, but even when dividing
> > System.currentTimeMillis() by ten, it will by too big for
> > using the value as a TimeTick.
> >
> > Best regards,
> > Frank
> >
> > PHIL BERGSTRESSER wrote:
> > > 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
> > >>
> > >>
> > >
> > >
> > >
> >
> >
> >
>


-- 
Joel Goguen
http://jgoguen.net/



More information about the SNMP4J mailing list