diff options
author | Caleb Bassi <calebjbassi@gmail.com> | 2018-02-22 23:58:48 -0800 |
---|---|---|
committer | Caleb Bassi <calebjbassi@gmail.com> | 2018-02-22 23:58:48 -0800 |
commit | f0efec1ec72b9a372b819495ba3ce90ed3f974f0 (patch) | |
tree | f2476b1776fe4948569ed277a31668c56ce6bb2c /widgets | |
parent | b262d2a5474138cbe8bdc872db5b6f56d8cc89af (diff) |
Changed utils to return a float64
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/disk.go | 2 | ||||
-rw-r--r-- | widgets/net.go | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/widgets/disk.go b/widgets/disk.go index ee8581c..9795795 100644 --- a/widgets/disk.go +++ b/widgets/disk.go @@ -33,5 +33,5 @@ func NewDisk() *Disk { func (d *Disk) update() { disk, _ := ps.Usage(d.fs) d.Percent = int(disk.UsedPercent) - d.Description = fmt.Sprintf(" (%dGB free)", utils.BytesToGB(disk.Free)) + d.Description = fmt.Sprintf(" (%dGB free)", int(utils.BytesToGB(disk.Free))) } diff --git a/widgets/net.go b/widgets/net.go index a38be1a..a6790b9 100644 --- a/widgets/net.go +++ b/widgets/net.go @@ -77,15 +77,16 @@ func (n *Net) update() { curUnit = "kB" } + var totalCvrt float64 if total >= 1000000000 { - total = utils.BytesToGB(total) + totalCvrt = utils.BytesToGB(total) totalUnit = "GB" } else if total >= 1000000 { - total = utils.BytesToMB(total) + totalCvrt = utils.BytesToMB(total) totalUnit = "MB" } - n.Lines[i].Title1 = fmt.Sprintf(" Total %s: %3d %s", method, total, totalUnit) - n.Lines[i].Title2 = fmt.Sprintf(" %s/s: %7d %2s/s", method, cur, curUnit) + n.Lines[i].Title1 = fmt.Sprintf(" Total %s: %5.1f %s", method, totalCvrt, totalUnit) + n.Lines[i].Title2 = fmt.Sprintf(" %s/s: %9d %2s/s", method, cur, curUnit) } } |