On Mon, 2005-08-15 at 06:52 -0700, David T. Perkins wrote:
> Guys,
>
> Why not...
>
> long get_uptime_in_sec(void)
> {
> struct sysinfo info;
>
> if (sysinfo(&info) < 0 ) {
> perror("getting uptime");
> return -1; /* TODO: maybe this should be 0 */
> }
> return info.uptime;
> }
D'oh!
I'm too used to returning a pointer to data,
and having to ensure that it remains valid
after the routine exits.
You're perfectly correct, of course.
Dave
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders