On 29/08/06, wrote:
> In mib2c.old-api.conf approach ( 5.2.1 version in Fedora ), for
> DateAndTime OIDs, I am retuning the value as
> return (u_char *) "1970-1-1,0:0:0.0,-0:0";

No - that's not correct.
Please read the description of DateAndTime in SNMPv2-TC.txt
This is a *binary* representation, not a text string.

> Do I need to convert this string to some format?


> Since DataAndTime is OCTECT-STRING, I had tried
> u_char dt[]={ '0x07' , '0xb2' , '0x01' , '0x01' , '0x00' , '0x00' ,
> '0x00' , '0x00' , '0x2d', '0x00','0x00' };

Hmmm... Yes - that looks to be correct.

> But I didn't get the correct display for my snmpget.

So what *did* you get for this value?

> Please let me know if there some API which will take my string and convert
> to required format.

See 'netsnmp_dateandtime_set_buf_from_vars()' [what a horrible name!]
or 'date_n_time()' in snmplib/snmp-tc.c


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Net-snmp-coders mailing list