summaryrefslogtreecommitdiffstats
path: root/sbin/dump
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2004-05-21 20:13:33 +0000
committerimp <imp@FreeBSD.org>2004-05-21 20:13:33 +0000
commit00e1e7a0663c29f34ac91a5312379002cd4df17d (patch)
tree9f7f66d5d6958aea135dffb1a600546e6c8640c8 /sbin/dump
parent2cc416478d59ced882a233dd559abd02168863ef (diff)
downloadFreeBSD-src-00e1e7a0663c29f34ac91a5312379002cd4df17d.zip
FreeBSD-src-00e1e7a0663c29f34ac91a5312379002cd4df17d.tar.gz
Enter the 1990's and assume that the computer knows what time it is.
Print the ETA of dump being finished, rather than a cryptic delta time. Also, if we have written more blocks than the tapesize, assume that we are 99.99% done and that we'll be finished 'soon'.
Diffstat (limited to 'sbin/dump')
-rw-r--r--sbin/dump/optr.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/sbin/dump/optr.c b/sbin/dump/optr.c
index 4261050..aa2c06a 100644
--- a/sbin/dump/optr.c
+++ b/sbin/dump/optr.c
@@ -189,24 +189,31 @@ void
timeest(void)
{
double percent;
- time_t tnow;
+ time_t tnow, tdone;
int deltat, hours, mins;
- (void) time(&tnow);
- deltat = (blockswritten == 0) ? 0 : tstart_writing - tnow +
- (double)(tnow - tstart_writing) / blockswritten * tapesize;
- percent = (blockswritten * 100.0) / tapesize;
- hours = deltat / 3600;
- mins = (deltat % 3600) / 60;
-
- setproctitle("%s: pass %d: %3.2f%% done, finished in %d:%02d",
- disk, passno, percent, hours, mins);
- if (tnow >= tschedule) {
- tschedule = tnow + 300;
- if (blockswritten < 500)
- return;
- msg("%3.2f%% done, finished in %d:%02d\n", percent, hours,
- mins);
+ if (blockswritten > tapesize) {
+ setproctitle("%s: 99.99%% done, finished soon", disk);
+ msg("99.99%% done, finished soon\n");
+ } else {
+ (void) time(&tnow);
+ deltat = (blockswritten == 0) ? 0 : tstart_writing - tnow +
+ (double)(tnow - tstart_writing) / blockswritten * tapesize;
+ tdone = tnow + deltat;
+ percent = (blockswritten * 100.0) / tapesize;
+ hours = deltat / 3600;
+ mins = (deltat % 3600) / 60;
+
+ setproctitle(
+ "%s: pass %d: %3.2f%% done, finished in %d:%02d at %s",
+ disk, passno, percent, hours, mins, ctime(&tdone));
+ if (tnow >= tschedule) {
+ tschedule = tnow + 300;
+ if (blockswritten < 500)
+ return;
+ msg("%3.2f%% done, finished in %d:%02d at %s", percent,
+ hours, mins, ctime(&tdone));
+ }
}
}
OpenPOWER on IntegriCloud