From 02dcf28b5875df173bef8c14a9ddd3d3ce67c5d4 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 1 Sep 2012 14:45:15 +0000 Subject: Rework all non-contributed files that use `struct timezone'. This structure is not part of POSIX. According to POSIX, gettimeofday() has the following prototype: int gettimeofday(struct timeval *restrict tp, void *restrict tzp); Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is not used). Remove dead error handling code. Also use NULL for a nul-pointer instead of integer 0. While there, change all pieces of code that only use tv_sec to use time(3), as this provides less overhead. --- usr.bin/systat/ifstat.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'usr.bin/systat/ifstat.c') diff --git a/usr.bin/systat/ifstat.c b/usr.bin/systat/ifstat.c index fc853b0..3e45499 100644 --- a/usr.bin/systat/ifstat.c +++ b/usr.bin/systat/ifstat.c @@ -247,8 +247,7 @@ fetchifstat(void) old_outb = ifp->if_mib.ifmd_data.ifi_obytes; ifp->tv_lastchanged = ifp->if_mib.ifmd_data.ifi_lastchange; - if (gettimeofday(&new_tv, (struct timezone *)0) != 0) - IFSTAT_ERR(2, "error getting time of day"); + (void)gettimeofday(&new_tv, NULL); (void)getifmibdata(ifp->if_row, &ifp->if_mib); new_inb = ifp->if_mib.ifmd_data.ifi_ibytes; -- cgit v1.1