From 8e88cda8e13f0d4c92e03a98460ce8c60bf53ed7 Mon Sep 17 00:00:00 2001 From: exhq Date: Thu, 7 Mar 2024 11:25:26 +0330 Subject: [PATCH] i most likely was on drugs when i wrote this 2 years ago. im extremely sorry --- data/data.go | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/data/data.go b/data/data.go index 052170a..2fb101d 100644 --- a/data/data.go +++ b/data/data.go @@ -128,19 +128,27 @@ func GetDistroVariable(varname string) string { } return strings.Trim(distro_tuples[varname], "\"") } + +// FormatTime +// I wrote this garbage 2 years ago. I'm too lazy to completely rewrite it. its absolute garbage. im so sorry. func FormatTime(seconds int) string { minutes := seconds / 60 - secondsre := strconv.Itoa(seconds % 60) - hour := strconv.Itoa(minutes / 60) - minutesre := strconv.Itoa(minutes % 60) - return (hour + "h " + minutesre + "m " + secondsre + "s") + secondsRemaining := strconv.Itoa(seconds % 60) + hour := minutes / 60 + minutesRemaining := strconv.Itoa(minutes % 60) + if hour <= 24 { + return strconv.Itoa(hour) + "h " + minutesRemaining + "m " + secondsRemaining + "s" + } + day := strconv.Itoa(hour / 24) + hourRemaining := strconv.Itoa(hour % 24) + return day + "d " + hourRemaining + "h " + minutesRemaining + "m " + secondsRemaining + "s" } func GetCPU() { mem, _ := os.Open("/proc/cpuinfo") - mem_info := make([]byte, 1024) - mem.Read(mem_info) + memInfo := make([]byte, 1024) + mem.Read(memInfo) mem.Close() - print(mem_info) + print(memInfo) } func GetTerminal() string { a, existprgm := os.LookupEnv("TERM_PROGRAM")