Prefix the estimated completion time of "--fineta" with "FIN" rather than "ETA" to differentiate it from the "ETA" provided by "--eta" (#43).

This commit is contained in:
Andrew Wood
2024-10-04 19:45:08 +01:00
parent 4b399995f5
commit a2c6490d31
9 changed files with 91 additions and 69 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ is acknowledged and greatly appreciated:
* Kim Krecht - suggested buffer fill status and last bytes output display options
* Cristian Ciupitu <http://ciupicri.github.io>, Josh Stone - pointed out file descriptor leak with helpful suggestions (Josh Stone initially noticed the missing close)
* Jan Seda - found issue with `splice()` and *SPLICE_F_NONBLOCK* causing slowdown
* André Stapf - pointed out formatting problem e.g. 13GB -> 13.1GB which should be shown 13.0GB -> 13.1GB; highlighted on-startup row swapping in "`-c`", and suggested "`--discard`"
* André Stapf - pointed out formatting problem e.g. 13GB -> 13.1GB which should be shown 13.0GB -> 13.1GB; highlighted on-startup row swapping in "`-c`", and suggested "`--discard`"; suggested making "`--fineta`" have a "FIN" prefix
* Damon Harper <http://www.usrbin.ca/> - suggested "`-D`" / "`--delay-start`" option
* Ganaël Laplanche <http://www.martymac.org> - provided patch for `lstat64()` on systems that do not support it
* Peter Korsgaard <http://www.buildroot.net/> - provided similar patch for `lstat64()`, specifically for uClibc support; provided AIX cross-compilation patch to fix bug in "`-lc128`" check
+2 -1
View File
@@ -4,8 +4,9 @@
* feature: "`--rate`" can now be used with "`--numeric`" ([#17](https://codeberg.org/a-j-wood/pv/issues/17))
* i18n: complete set of German translations supplied by Hartmut Goebel ([#98](https://codeberg.org/a-j-wood/pv/pulls/98))
* fix: resume stopped pipelines when running in the background (part of [#56](https://codeberg.org/a-j-wood/pv/issues/56))
* fix: write UTC timestamps in debugging mode to avoid lockups in signal handlers
* fix: prefix completion time ("`--fineta`") with *FIN* rather than *ETA* ([#43](https://codeberg.org/a-j-wood/pv/issues/43))
* fix: correct a memory leak in "`--watchfd PID`"
* fix: write UTC timestamps in debugging mode to avoid lockups in signal handlers
* cleanup: removed TODO.md, since it's just an outdated copy of the issue tracker
* cleanup: re-ordered structure members to reduce padding
* cleanup: improved readability of SIGTTOU handling code
+12 -10
View File
@@ -109,9 +109,8 @@ If no display switches are specified,
.B pv
behaves as if
.BR \-p ", " \-t ", " \-e ", " \-r ", and " \-b
had been given (i.e. everything except average rate is switched on).
Otherwise, only those display types that are explicitly switched on will be
shown.
had been given. Otherwise, only those display types that are explicitly
switched on will be shown.
.TP
.B \-p, \-\-progress
Turn the progress bar on. If any inputs are not files, or are
@@ -129,13 +128,16 @@ has been running for.
.B \-e, \-\-eta
Turn the ETA timer on. This will attempt to guess, based on current
transfer rates and the total data size, how long it will be before
completion. This option will have no effect if the total data size cannot
be determined.
completion. The countdown is prefixed with "ETA". This option will have no
effect if the total data size cannot be determined.
.TP
.B \-I, \-\-fineta
Turn the ETA timer on, but display the estimated local time of arrival
instead of time left. When the estimated time is more than 6 hours in the
future, the date is shown as well.
Turn the ETA timer on, but display the estimated local time at which the
transfer will finish, instead of the amount of time remaining. When the
estimated time is more than 6 hours in the future, the date is shown as
well. The time is prefixed with "FIN" for finish time. As with
.BR \-\-eta ,
this option will have no effect if the total data size cannot be determined.
.TP
.B \-r, \-\-rate
Turn the rate counter on. This will display the current rate of data
@@ -567,7 +569,7 @@ ETA as time remaining. Equivalent to
.BR \-e .
.TP
.B %I
ETA as local time of completion. Equivalent to
ETA as local time at which the transfer will finish. Equivalent to
.BR \-I .
.TP
.B %r
@@ -616,7 +618,7 @@ A single %.
.P
The format string equivalent of turning on all display switches is
.BR "\`%N %b %T %t %r %a %p %e'" .
.BR "\`%N %b %T %t %r %a %p %e %I'" .
.SH COMMON SWITCHES
+13 -10
View File
@@ -71,9 +71,8 @@ output modifiers, and general options.
# DISPLAY SWITCHES
If no display switches are specified, **pv** behaves as if **-p**,
**-t**, **-e**, **-r**, and **-b** had been given (i.e. everything
except average rate is switched on). Otherwise, only those display types
that are explicitly switched on will be shown.
**-t**, **-e**, **-r**, and **-b** had been given. Otherwise, only those
display types that are explicitly switched on will be shown.
**-p, \--progress**
@@ -92,14 +91,17 @@ that are explicitly switched on will be shown.
: Turn the ETA timer on. This will attempt to guess, based on current
transfer rates and the total data size, how long it will be before
completion. This option will have no effect if the total data size
cannot be determined.
completion. The countdown is prefixed with \"ETA\". This option will
have no effect if the total data size cannot be determined.
**-I, \--fineta**
: Turn the ETA timer on, but display the estimated local time of
arrival instead of time left. When the estimated time is more than 6
hours in the future, the date is shown as well.
: Turn the ETA timer on, but display the estimated local time at which
the transfer will finish, instead of the amount of time remaining.
When the estimated time is more than 6 hours in the future, the date
is shown as well. The time is prefixed with \"FIN\" for finish time.
As with **\--eta**, this option will have no effect if the total
data size cannot be determined.
**-r, \--rate**
@@ -413,7 +415,8 @@ be used:
**%I**
: ETA as local time of completion. Equivalent to **-I**.
: ETA as local time at which the transfer will finish. Equivalent to
**-I**.
**%r**
@@ -453,7 +456,7 @@ be used:
: A single %.
The format string equivalent of turning on all display switches is
**\`%N %b %T %t %r %a %p %e\'**.
**\`%N %b %T %t %r %a %p %e %I\'**.
# COMMON SWITCHES
+14 -10
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-10-04 14:48+0100\n"
"POT-Creation-Date: 2024-10-04 19:39+0100\n"
"PO-Revision-Date: 2024-09-29 11:07+0000\n"
"Last-Translator: a-j-wood <a-j-wood@users.noreply.translate.codeberg.org>\n"
"Language-Team: German <https://translate.codeberg.org/projects/pv/pv/de/>\n"
@@ -397,42 +397,46 @@ msgstr "Sperrversuch fehlgeschlagen"
msgid "failed to open terminal"
msgstr "konnte Terminal nicht öffnen"
#: src/pv/display.c:231
#: src/pv/display.c:216
msgid "yzafpnum kMGTPEZY"
msgstr "yzafpnµm kMGTPEZY"
#: src/pv/display.c:249
#: src/pv/display.c:234
msgid "yzafpnum KMGTPEZY"
msgstr "yzafpnµm KMGTPEZY"
#: src/pv/display.c:829 src/pv/transfer.c:970
#: src/pv/display.c:653 src/pv/transfer.c:970
msgid "buffer allocation failed"
msgstr "Speicherzuweisung für den Puffer fehlgeschlagen"
#: src/pv/display.c:938
#: src/pv/display.c:789
msgid "b"
msgstr "b"
#: src/pv/display.c:941 src/pv/transfer.c:602
#: src/pv/display.c:792 src/pv/transfer.c:602
msgid "B"
msgstr "B"
#: src/pv/display.c:985 src/pv/display.c:1000 src/pv/loop.c:418
#: src/pv/display.c:836 src/pv/display.c:851 src/pv/loop.c:418
msgid "b/s"
msgstr "b/s"
#: src/pv/display.c:989 src/pv/display.c:1004
#: src/pv/display.c:840 src/pv/display.c:855
msgid "/s"
msgstr "/s"
#: src/pv/display.c:989 src/pv/display.c:1004 src/pv/loop.c:418
#: src/pv/display.c:840 src/pv/display.c:855 src/pv/loop.c:418
msgid "B/s"
msgstr "B/s"
#: src/pv/display.c:1032 src/pv/display.c:1036 src/pv/display.c:1102
#: src/pv/display.c:883 src/pv/display.c:887
msgid "ETA"
msgstr "ETA"
#: src/pv/display.c:953
msgid "FIN"
msgstr ""
#: src/pv/file.c:149
msgid "failed to seek to start of output"
msgstr "Konnte nicht zum Anfang der Ausgabe springen"
+14 -10
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-10-04 14:48+0100\n"
"POT-Creation-Date: 2024-10-04 19:39+0100\n"
"Language: fr\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Date: 1999-06-01 15:18:29+0100\n"
@@ -393,42 +393,46 @@ msgstr "échec de la tentative de verrouillage"
msgid "failed to open terminal"
msgstr "échec de l'ouverture du terminal"
#: src/pv/display.c:231
#: src/pv/display.c:216
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:249
#: src/pv/display.c:234
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:829 src/pv/transfer.c:970
#: src/pv/display.c:653 src/pv/transfer.c:970
msgid "buffer allocation failed"
msgstr "échec de l'allocation de mémoire tampon"
#: src/pv/display.c:938
#: src/pv/display.c:789
msgid "b"
msgstr ""
#: src/pv/display.c:941 src/pv/transfer.c:602
#: src/pv/display.c:792 src/pv/transfer.c:602
msgid "B"
msgstr "O"
#: src/pv/display.c:985 src/pv/display.c:1000 src/pv/loop.c:418
#: src/pv/display.c:836 src/pv/display.c:851 src/pv/loop.c:418
msgid "b/s"
msgstr ""
#: src/pv/display.c:989 src/pv/display.c:1004
#: src/pv/display.c:840 src/pv/display.c:855
msgid "/s"
msgstr "/s"
#: src/pv/display.c:989 src/pv/display.c:1004 src/pv/loop.c:418
#: src/pv/display.c:840 src/pv/display.c:855 src/pv/loop.c:418
msgid "B/s"
msgstr "O/s"
#: src/pv/display.c:1032 src/pv/display.c:1036 src/pv/display.c:1102
#: src/pv/display.c:883 src/pv/display.c:887
msgid "ETA"
msgstr "ETA"
#: src/pv/display.c:953
msgid "FIN"
msgstr ""
#: src/pv/file.c:149
msgid "failed to seek to start of output"
msgstr "ne peut pas passer au début de la sortie"
+14 -10
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-10-04 14:48+0100\n"
"POT-Creation-Date: 2024-10-04 19:39+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -377,42 +377,46 @@ msgstr ""
msgid "failed to open terminal"
msgstr "nie udało się otworzyć terminala"
#: src/pv/display.c:231
#: src/pv/display.c:216
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:249
#: src/pv/display.c:234
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:829 src/pv/transfer.c:970
#: src/pv/display.c:653 src/pv/transfer.c:970
msgid "buffer allocation failed"
msgstr "nie udało się zaalokować bufora"
#: src/pv/display.c:938
#: src/pv/display.c:789
msgid "b"
msgstr ""
#: src/pv/display.c:941 src/pv/transfer.c:602
#: src/pv/display.c:792 src/pv/transfer.c:602
msgid "B"
msgstr "B"
#: src/pv/display.c:985 src/pv/display.c:1000 src/pv/loop.c:418
#: src/pv/display.c:836 src/pv/display.c:851 src/pv/loop.c:418
msgid "b/s"
msgstr ""
#: src/pv/display.c:989 src/pv/display.c:1004
#: src/pv/display.c:840 src/pv/display.c:855
msgid "/s"
msgstr "/s"
#: src/pv/display.c:989 src/pv/display.c:1004 src/pv/loop.c:418
#: src/pv/display.c:840 src/pv/display.c:855 src/pv/loop.c:418
msgid "B/s"
msgstr "B/s"
#: src/pv/display.c:1032 src/pv/display.c:1036 src/pv/display.c:1102
#: src/pv/display.c:883 src/pv/display.c:887
msgid "ETA"
msgstr "ETA"
#: src/pv/display.c:953
msgid "FIN"
msgstr ""
#: src/pv/file.c:149
msgid "failed to seek to start of output"
msgstr ""
+14 -10
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-10-04 14:48+0100\n"
"POT-Creation-Date: 2024-10-04 19:39+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -380,42 +380,46 @@ msgstr "tentativa de bloqueio falhou"
msgid "failed to open terminal"
msgstr "erro abrindo o terminal"
#: src/pv/display.c:231
#: src/pv/display.c:216
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:249
#: src/pv/display.c:234
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:829 src/pv/transfer.c:970
#: src/pv/display.c:653 src/pv/transfer.c:970
msgid "buffer allocation failed"
msgstr "erro alocando o buffer"
#: src/pv/display.c:938
#: src/pv/display.c:789
msgid "b"
msgstr ""
#: src/pv/display.c:941 src/pv/transfer.c:602
#: src/pv/display.c:792 src/pv/transfer.c:602
msgid "B"
msgstr ""
#: src/pv/display.c:985 src/pv/display.c:1000 src/pv/loop.c:418
#: src/pv/display.c:836 src/pv/display.c:851 src/pv/loop.c:418
msgid "b/s"
msgstr ""
#: src/pv/display.c:989 src/pv/display.c:1004
#: src/pv/display.c:840 src/pv/display.c:855
msgid "/s"
msgstr ""
#: src/pv/display.c:989 src/pv/display.c:1004 src/pv/loop.c:418
#: src/pv/display.c:840 src/pv/display.c:855 src/pv/loop.c:418
msgid "B/s"
msgstr "B/s"
#: src/pv/display.c:1032 src/pv/display.c:1036 src/pv/display.c:1102
#: src/pv/display.c:883 src/pv/display.c:887
msgid "ETA"
msgstr "ETA"
#: src/pv/display.c:953
msgid "FIN"
msgstr ""
#: src/pv/file.c:149
msgid "failed to seek to start of output"
msgstr "não pode mover para o início da produção"
+7 -7
View File
@@ -740,7 +740,7 @@ bool pv_format(pvstate_t state, bool final)
char *component_content;
size_t component_buf_size;
size_t buf_idx;
bool show_eta;
bool show_fineta;
time_t now;
time_t then;
struct tm *time_ptr;
@@ -907,12 +907,12 @@ bool pv_format(pvstate_t state, bool final)
/* Estimated time of completion - if size is known. */
now = time(NULL);
show_eta = true;
show_fineta = true;
time_format = NULL;
/*
* The ETA may be hidden by a failed ETA string
* generation.
* The completion clock time may be hidden by a
* failed localtime lookup.
*/
eta =
@@ -940,7 +940,7 @@ bool pv_format(pvstate_t state, bool final)
time_ptr = localtime(&then);
if (NULL == time_ptr) {
show_eta = false;
show_fineta = false;
} else {
/* Localtime keeps data stored in a static
* buffer that gets overwritten by time
@@ -950,7 +950,7 @@ bool pv_format(pvstate_t state, bool final)
size_t component_content_length;
/*@-mustfreefresh @ */
(void) pv_snprintf(component_content, component_buf_size, "%.16s ", _("ETA"));
(void) pv_snprintf(component_content, component_buf_size, "%.16s ", _("FIN"));
/*@+mustfreefresh @ *//* splint: see above. */
component_content_length = strlen(component_content); /* flawfinder: ignore */
/* flawfinder: always bounded with \0 by pv_snprintf(). */
@@ -958,7 +958,7 @@ bool pv_format(pvstate_t state, bool final)
component_buf_size - 1 - component_content_length, time_format, &time);
}
if (!show_eta) {
if (!show_fineta) {
size_t erase_idx;
for (erase_idx = 0;
erase_idx < component_buf_size && component_content[erase_idx] != '\0';