Skip to content

Commit

Permalink
cosmetic eta improvements:
Browse files Browse the repository at this point in the history
* u2c: strip hh:mm:ss past 30 days
* u2js: fix "infini.ty" in elapsed-times
  • Loading branch information
9001 committed Nov 23, 2024
1 parent 520ac8f commit b10843d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/u2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,8 @@ def _fancy(self):

spd = humansize(spd)
self.eta = str(datetime.timedelta(seconds=int(eta)))
if eta > 2591999:
self.eta = self.eta.split(",")[0] # truncate HH:MM:SS
sleft = humansize(self.nbytes - self.up_b)
nleft = self.nfiles - self.up_f
tail = "\033[K\033[u" if VT100 and not self.ar.ns else "\r"
Expand Down
2 changes: 2 additions & 0 deletions copyparty/web/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,8 @@ if (window.Number && Number.isFinite)

function f2f(val, nd) {
// 10.toFixed(1) returns 10.00 for certain values of 10
if (!isNum(val))
val = 999;
val = (val * Math.pow(10, nd)).toFixed(0).split('.')[0];
return nd ? (val.slice(0, -nd) || '0') + '.' + val.slice(-nd) : val;
}
Expand Down

0 comments on commit b10843d

Please sign in to comment.