Skip to content
This repository has been archived by the owner on Mar 3, 2018. It is now read-only.

Commit

Permalink
Tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
back2dos committed Nov 1, 2017
1 parent 7287594 commit 0a59c7f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/switchx/Download.hx
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,18 @@ class Download {
}

function pct(f:Float)
return Std.string(Math.round(1000 * f) / 10).lpad(' ', 4) + '%';
return (switch Std.string(Math.round(1000 * f) / 10) {
case whole = _.indexOf('.') => -1: '$whole.0';
case v: v;
}).lpad(' ', 5) + '%';

var lastUpdate = Date.fromTime(0).getTime();

function update() {
if (saved == total) progress('Done!\n');
else {
var now = Date.now().getTime();
if (now > lastUpdate + 100) {
if (now > lastUpdate + 137) {

lastUpdate = now;
var messages = [];
Expand Down

0 comments on commit 0a59c7f

Please sign in to comment.