summaryrefslogtreecommitdiffstats
path: root/bin/dd/dd.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-11-13 20:00:03 +0000
committerphk <phk@FreeBSD.org>1996-11-13 20:00:03 +0000
commit6c0fd53b323fe1e401dc8c67516a053bfe61f962 (patch)
tree53fc828f0ad161e700a6fc8fe723a969aade6a4b /bin/dd/dd.c
parent46e1202181d505ac01d3b6baa6922896edbfca8a (diff)
downloadFreeBSD-src-6c0fd53b323fe1e401dc8c67516a053bfe61f962.zip
FreeBSD-src-6c0fd53b323fe1e401dc8c67516a053bfe61f962.tar.gz
Bruce says: "You have been programming in the kernel for too long :-)."
and he's right ... I forgot about this floating point stuff you can use in user-land :-) Increase precision of duration to microseconds. No heuristics to avoid overflow in calculation needed - just depend on DBL_MAX being a bit larger than LONG_MAX. Use double instead of `struct timeval' in dd.h so that everything doesn't have to include <sys/time.h>. Fixed style bugs in recent and old FreeBSD changes. Reviewed by: phk Submitted by: bde
Diffstat (limited to 'bin/dd/dd.c')
-rw-r--r--bin/dd/dd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/dd/dd.c b/bin/dd/dd.c
index a0c6f7a..a86c130 100644
--- a/bin/dd/dd.c
+++ b/bin/dd/dd.c
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: dd.c,v 1.5 1995/10/23 21:31:48 ache Exp $
+ * $Id: dd.c,v 1.6 1996/11/12 23:09:09 phk Exp $
*/
#ifndef lint
@@ -56,12 +56,12 @@ static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94";
#include <err.h>
#include <errno.h>
#include <fcntl.h>
+#include <locale.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <locale.h>
#include "dd.h"
#include "extern.h"
@@ -85,7 +85,7 @@ main(argc, argv)
int argc;
char *argv[];
{
- (void) setlocale(LC_CTYPE, "");
+ (void)setlocale(LC_CTYPE, "");
jcl(argv);
setup();
@@ -105,6 +105,7 @@ static void
setup()
{
u_int cnt;
+ struct timeval tv;
if (in.name == NULL) {
in.name = "stdin";
@@ -213,7 +214,8 @@ setup()
ctab[cnt] = cnt;
}
}
- (void)gettimeofday(&st.start, 0); /* Statistics timestamp. */
+ (void)gettimeofday(&tv, (struct timezone *)NULL);
+ st.start = tv.tv_sec + tv.tv_usec * 1e-6;
}
static void
OpenPOWER on IntegriCloud