Re: sysUptime uses gettimeofday

Pushpa Thimmaiah <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <CAASqVJXDEXopcQh-9ffiB4e4Wh2059Cx1DAwXX_fcywYcvrXmQ@mail.gmail.com>
Thank you Magnus Fromreide, Anders Wallin and Stuart Henderson for the
reply.

Stuart Henderson,

I am using net-snmp.5.7.1.  Object sysUpTime uses API
netsnmp_get_agent_uptime() and they inturn uses gettimeofday().
If time on device changes after snmpd starts then sysUpTime value is
confusing.

Scenario:
1. Linux device time is  'Mon Aug 28 21:01:29 UTC 2017'
2. start snmpd
3.Now  sysUptime = 4 seconds
4. Set linux device time 'Mon Mar 26 05:53:07 UTC 2018'
5. sysUptime = 209 days  <------ This is not correct in this scenario.

Thank you,
Pushpa.T


On Fri, Mar 30, 2018 at 2:01 PM, Stuart Henderson <[email protected]>
wrote:

> In gmane.network.net-snmp.devel, you wrote:
> > I believed that sysUpTime is counter that increments  every seconds. But
> In
> > net-snmp code ,
> >  sysUpTime being calculated as difference between 'snmpd-starttime' and
> > 'current time' .
> >
> > I would like to know reason for sysUpTime been calculated as difference
> in
> > time instead of incremental-counter.
> > Is there any constraints ?
>
> Which version are you looking at? net-snmp has been using clock_gettime
> with (incremental) CLOCK_MONOTONIC for sysUptime for about 6 years.
>
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.