Michael Sinz writes:
> > if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 &&
> > boottime.tv_sec != 0) {
> > uptime = now - boottime.tv_sec;
> > uptime += 30;
> > ====================== ^^^^^
> > days = uptime / 86400;
> > uptime %= 86400;
> > hrs = uptime / 3600;
> > uptime %= 3600;
> > mins = uptime / 60;
> > secs = uptime % 60;
> > (void)printf(" up");
> >
> > why utility increases uptime on 30 seconds ??
> > Is any real reasons for it ?
>
> >From my reading of this, it seems to want to round the uptime to
> the nearest minute -- afterall, w and uptime both only show the uptime
> in minutes (well, days, hours, and minutes)
not exactly right:
...
DUMMYNET initialized (010124)
Waiting 2 seconds for SCSI devices to settle
SMP: AP CPU #1 Launched!
Mounting root from ufs:/dev/da0s2a
da0 at ahc0 bus 0 target 12 lun 0
da0: <IBM DNES-309170W SA30> Fixed Direct Access SCSI-3 device
da0: 80.000MB/s transfers (40.000MHz, offset 31, 16bit), Tagged Queueing Enabled
da0: 8748MB (17916240 512 byte sectors: 255H 63S/T 1115C)
Enter full pathname of shell or RETURN for /bin/sh:
# mount -a
# uptime
3:12PM up 42 secs, 3 users, load averages: 0.21, 0.05, 0.02
#
42sec instead of more realistic 12sec
looking into w.c more:
if (days > 0)
(void)printf(" %d day%s,", days, days > 1 ? "s" : "");
if (hrs > 0 && mins > 0)
(void)printf(" %2d:%02d,", hrs, mins);
else if (hrs > 0)
(void)printf(" %d hr%s,", hrs, hrs > 1 ? "s" : "");
else if (mins > 0)
(void)printf(" %d min%s,", mins, mins > 1 ? "s" : "");
else
(void)printf(" %d sec%s,", secs, secs > 1 ? "s" : "");
}
--
TSB Russian Express, Moscow
Vladimir B. Grebenschikov, [EMAIL PROTECTED]
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message