summaryrefslogtreecommitdiffstats
path: root/perl-install/c
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2000-10-04 13:57:08 +0000
committerFrancois Pons <fpons@mandriva.com>2000-10-04 13:57:08 +0000
commitf6b05a31b60fb74c908967f2eb5c5a750846ea32 (patch)
tree71913b2a4d579289cac2c0f6e782681a40387e3a /perl-install/c
parentb355c7624b8c48db238faefe40b59ca8ad886fba (diff)
downloaddrakx-backup-do-not-use-f6b05a31b60fb74c908967f2eb5c5a750846ea32.tar
drakx-backup-do-not-use-f6b05a31b60fb74c908967f2eb5c5a750846ea32.tar.gz
drakx-backup-do-not-use-f6b05a31b60fb74c908967f2eb5c5a750846ea32.tar.bz2
drakx-backup-do-not-use-f6b05a31b60fb74c908967f2eb5c5a750846ea32.tar.xz
drakx-backup-do-not-use-f6b05a31b60fb74c908967f2eb5c5a750846ea32.zip
*** empty log message ***
Diffstat (limited to 'perl-install/c')
-rw-r--r--perl-install/c/stuff.xs.pm10
1 files changed, 9 insertions, 1 deletions
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 <sys/types.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
+#include <sys/time.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/utsname.h>
@@ -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;