Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Oct 2001 10:08:12 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Peter Pentchev <roam@ringlet.net>
Cc:        cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sbin/dump optr.c
Message-ID:  <200110301808.f9UI8CX94271@apollo.backplane.com>
References:  <200110280613.f9S6Dlc96209@freefall.freebsd.org> <20011030110300.B622@straylight.oblivion.bg>

next in thread | previous in thread | raw e-mail | index | archive | help

:
:On Sat, Oct 27, 2001 at 11:13:47PM -0700, Matt Dillon wrote:
:> dillon      2001/10/27 23:13:47 PDT
:> 
:>   Modified files:
:>     sbin/dump            optr.c 
:>   Log:
:>   deltat declared time_t, msg("") call used %d (assumed time_t == int).
:>   Changed deltat to be an int (result of delta time calculation).
:>   
:>   MFC after:	1 day
:
:How about the following change?  I don't think it's really correct either,
:technically deltat should be declared 'double' and the division by 3600
:should be rewritten; still, isn't difftime(3) the correct way to, well,
:to diff times? :)
:
:(And yes, I know that actual subtraction will work as well.)
:
:G'luck,
:Peter

    Yes, for absolute correctness, but if you were to start changing
    delta calculations to use difftime() there are a couple of hundred
    places in our codebase where it could be done.  I don't see any 
    particular reason to go that far, at least not now, so I think it's
    better to leave the calculation as it stands.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>

:-- 
:If I had finished this sentence,
:
:Index: src/sbin/dump/optr.c
:===================================================================
:RCS file: /home/ncvs/src/sbin/dump/optr.c,v
:retrieving revision 1.15
:diff -u -r1.15 optr.c
:--- src/sbin/dump/optr.c	28 Oct 2001 06:13:47 -0000	1.15
:+++ src/sbin/dump/optr.c	30 Oct 2001 08:59:59 -0000
:@@ -200,9 +200,9 @@
: 		tschedule = tnow + 300;
: 		if (blockswritten < 500)
: 			return;
:-		deltat = tstart_writing - tnow +
:-			(1.0 * (tnow - tstart_writing))
:-			/ blockswritten * tapesize;
:+		deltat = (int)(difftime(tstart_writing, tnow) +
:+			difftime(tnow, tstart_writing)
:+			/ blockswritten * tapesize);
: 		msg("%3.2f%% done, finished in %d:%02d\n",
: 			(blockswritten * 100.0) / tapesize,
: 			deltat / 3600, (deltat % 3600) / 60);
:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110301808.f9UI8CX94271>