refactor: round up ram to 2 decimals
This commit is contained in:
parent
2ddc276257
commit
dff0a8ca47
@ -48,9 +48,9 @@ func GetDist() (string, string) {
|
|||||||
func getSizeRam(total, avaible, used *int) string {
|
func getSizeRam(total, avaible, used *int) string {
|
||||||
if *total >= 1024*1024 && *avaible >= 1024*1024 {
|
if *total >= 1024*1024 && *avaible >= 1024*1024 {
|
||||||
*used = *total - *avaible
|
*used = *total - *avaible
|
||||||
usedGiB := *used / (1024 * 1024)
|
usedGiB := float64(*used) / (1024 * 1024)
|
||||||
totalGiB := *total / (1024 * 1024)
|
totalGiB := float64(*total) / (1024 * 1024)
|
||||||
ram := fmt.Sprintf("%d / %d Gi", usedGiB, totalGiB)
|
ram := fmt.Sprintf("%.2f / %.2f GiB", usedGiB, totalGiB)
|
||||||
ram = strings.TrimSpace(ram)
|
ram = strings.TrimSpace(ram)
|
||||||
return ram
|
return ram
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user