summaryrefslogtreecommitdiffstats
path: root/bin/dd
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2012-09-01 14:45:15 +0000
committered <ed@FreeBSD.org>2012-09-01 14:45:15 +0000
commit02dcf28b5875df173bef8c14a9ddd3d3ce67c5d4 (patch)
tree496a0b9a3b14c27d50e1ae3b28265ecf5c2023f2 /bin/dd
parenta6edc1e4b7ca5750cf84fb6a6b048b796c0cc77f (diff)
downloadFreeBSD-src-02dcf28b5875df173bef8c14a9ddd3d3ce67c5d4.zip
FreeBSD-src-02dcf28b5875df173bef8c14a9ddd3d3ce67c5d4.tar.gz
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.
Diffstat (limited to 'bin/dd')
-rw-r--r--bin/dd/dd.c4
-rw-r--r--bin/dd/misc.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/bin/dd/dd.c b/bin/dd/dd.c
index 0bb43f7..637e0cc 100644
--- a/bin/dd/dd.c
+++ b/bin/dd/dd.c
@@ -232,8 +232,8 @@ setup(void)
ctab = casetab;
}
- (void)gettimeofday(&tv, (struct timezone *)NULL);
- st.start = tv.tv_sec + tv.tv_usec * 1e-6;
+ (void)gettimeofday(&tv, NULL);
+ st.start = tv.tv_sec + tv.tv_usec * 1e-6;
}
static void
diff --git a/bin/dd/misc.c b/bin/dd/misc.c
index 4f538bc..8edc5a5 100644
--- a/bin/dd/misc.c
+++ b/bin/dd/misc.c
@@ -59,7 +59,7 @@ summary(void)
double secs;
char buf[100];
- (void)gettimeofday(&tv, (struct timezone *)NULL);
+ (void)gettimeofday(&tv, NULL);
secs = tv.tv_sec + tv.tv_usec * 1e-6 - st.start;
if (secs < 1e-6)
secs = 1e-6;
OpenPOWER on IntegriCloud