>>>>> On Thu, 21 May 2009 16:53:43 +0200, "Tjernlund" <[email protected]> >>>>> said:
t> A few questions regarding times() usage in SNMPv3. Sorry for the delay. It's been a *really* busy month for me, and I'm frequently the one that responds to v3 related discussions. t> First, there is a bug in Linux times() that will return -1 a small t> time frame just before times() wrap. See, this is why working with time on systems is so much of a pain. It'd be easy to account for the incompatibilities on one system, but accounting for them all in a portable way is the tricky part. t> ret = times(NULL); /* Linux can handle NULL */ As an example, some OSes don't handle times(NULL). (Though your code, in this case, was in a protected ifdef; it's just an example of why portability is a pain). t> Secondly, Linux times() can take a NULL arg and that saves t> a lot of work in the kernel. Did you try profiling before and after to see how much of an improvement you got? Don't get me wrong, I think the idea is good... I'd just think it'd be impossible to measure considering everything else. Being efficient where possible, however, is always a good thing. t> Now to my real question, I don't understand why you need to t> handle wrapping especially: If I remember correctly that code that way because of variations across architectures for the size of clock_t vs an unsigned int maximum. For a clock_t size greater than the UNIT_MAX size it's a problem. This occurs on any system where clock_t is a long and a long is 8 bytes. The snmp engine time, however, is a 32 bit unsigned int as defined by how it's used in SNMP. So it needs to wrap at 32 bits even if the architecture can support wrapping at something higher. -- Wes Hardaker Please mail all replies to [email protected] ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
