$NetBSD: patch-af,v 1.1.1.1 2002/11/04 02:56:17 rh Exp $ --- sysdeps/freebsd/uptime.c.orig Thu May 27 16:04:16 1999 +++ sysdeps/freebsd/uptime.c @@ -49,6 +49,27 @@ void glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf) { +#ifdef __NetBSD__ + time_t now; + time_t uptime; + int mib[2]; + struct timeval boottime; + size_t size; + + mib[0] = CTL_KERN; + mib[1] = KERN_BOOTTIME; + size = sizeof(boottime); + if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 && + boottime.tv_sec != 0) { + time(&now); + buf->uptime = now - boottime.tv_sec; + /* XXX: don't know a useful value to put here. */ + buf->idletime = 0; + buf->flags = _glibtop_sysdeps_uptime; + } +#else + buf->flags = _glibtop_sysdeps_uptime; + glibtop_cpu cpu; glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0); @@ -70,4 +91,5 @@ buf->idletime = (double) cpu.idle / (double) cpu.frequency; buf->flags = _glibtop_sysdeps_uptime; +#endif }