From owner-cvs-all Tue Oct 30 10: 8:26 2001 Delivered-To: cvs-all@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 41D0C37B408; Tue, 30 Oct 2001 10:08:18 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id f9UI8CX94271; Tue, 30 Oct 2001 10:08:12 -0800 (PST) (envelope-from dillon) Date: Tue, 30 Oct 2001 10:08:12 -0800 (PST) From: Matthew Dillon Message-Id: <200110301808.f9UI8CX94271@apollo.backplane.com> To: Peter Pentchev Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sbin/dump optr.c References: <200110280613.f9S6Dlc96209@freefall.freebsd.org> <20011030110300.B622@straylight.oblivion.bg> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG : :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 :-- :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