From 5b2122b86ffdaf47da92c540e20f526a2f0a5114 Mon Sep 17 00:00:00 2001 From: "koizumi.aoi" Date: Tue, 15 Nov 2022 12:38:49 +0000 Subject: [PATCH] use megabytes instead of bytes Signed-off-by: Aoi K git-svn-id: file:///srv/svn/repo/mima/trunk@14 d2428f92-30f9-164c-8098-19ee57ce342c --- cmd/antifetch/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/antifetch/main.go b/cmd/antifetch/main.go index 639159e..5012f01 100644 --- a/cmd/antifetch/main.go +++ b/cmd/antifetch/main.go @@ -21,6 +21,9 @@ func main() { days := uptime / (60 * 60 * 24) hours := (uptime - (days * 60 * 60 * 24)) / (60 * 60) minutes := ((uptime - (days * 60 * 60 * 24)) - (hours * 60 * 60)) / 60 + + free_mem := v.Free / 1024 / 1024 + total_mem := v.Total / 1024 / 1024 if err != nil { log.Fatal(err) @@ -31,7 +34,7 @@ func main() { fmt.Printf("Editor:\t%s\n", os.Getenv("EDITOR")) fmt.Printf("System:\t%s\n", runtime.GOOS) fmt.Printf("Architecture:\t%s\n", runtime.GOARCH) - fmt.Printf("RAM:\t%v/%v (%f%%)\n", v.Total, v.Free, v.UsedPercent) + fmt.Printf("RAM:\t%vM/%vM (%f%%)\n", free_mem, total_mem, v.UsedPercent) fmt.Printf("Shell:\t%s\n", os.Getenv("SHELL")) fmt.Printf("Uptime:\t%dd:%dh:%dm\n", days, hours, minutes) }