From f6b05a31b60fb74c908967f2eb5c5a750846ea32 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Wed, 4 Oct 2000 13:57:08 +0000 Subject: *** empty log message *** --- perl-install/c/stuff.xs.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'perl-install/c/stuff.xs.pm') diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm index 52191cb27..5968289ac 100644 --- a/perl-install/c/stuff.xs.pm +++ b/perl-install/c/stuff.xs.pm @@ -11,6 +11,7 @@ print ' #include #include #include +#include #include #include #include @@ -710,6 +711,9 @@ rpmRunTransactions(trans, callbackOpen, callbackClose, callbackMessage, force) const unsigned long *param_ul1 = NULL; const unsigned long *param_ul2 = NULL; char *n = (char *) pkgKey; + static struct timeval tprev; + static struct timeval tcurr; + long delta; switch (what) { case RPMCALLBACK_INST_OPEN_FILE: { @@ -770,18 +774,22 @@ rpmRunTransactions(trans, callbackOpen, callbackClose, callbackMessage, force) case RPMCALLBACK_INST_START: { msg = "Starting installing package"; + gettimeofday(&tprev, NULL); param_s = n; last_amount = 0; } break; case RPMCALLBACK_INST_PROGRESS: - if (total && (amount - last_amount) * 22 / 4 / total) { + gettimeofday(&tcurr, NULL); + delta = 1000000 * (tcurr.tv_sec - tprev.tv_sec) + (tcurr.tv_usec - tprev.tv_usec); + if (delta > 200000 || amount >= total - 1) { /* (total && (amount - last_amount) * 22 / 4 / total)) { */ msg = "Progressing installing package"; param_s = n; param_ul1 = &amount; param_ul2 = &total; + tprev = tcurr; last_amount = amount; } break; default: break; -- cgit v1.2.1