From 94aa368cff322e667156571638a45bd3117a2739 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 15 Jan 2024 19:00:41 -0600 Subject: garbage collect after cleaning to retain history --- linuxstatus/timer.go | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 linuxstatus/timer.go (limited to 'linuxstatus/timer.go') diff --git a/linuxstatus/timer.go b/linuxstatus/timer.go deleted file mode 100644 index 17130f3..0000000 --- a/linuxstatus/timer.go +++ /dev/null @@ -1,36 +0,0 @@ -package linuxstatus - -import ( - "time" - "sort" - "strings" -) - -// timeFunction takes a function as an argument and returns the execution time. -func timeFunction(f func()) time.Duration { - startTime := time.Now() // Record the start time - f() // Execute the function - return time.Since(startTime) // Calculate the elapsed time -} - -// sortLines takes a string, splits it on newlines, sorts the lines, -// and rejoins them with newlines. -func sortLines(input string) string { - lines := strings.Split(input, "\n") - - // Trim leading and trailing whitespace from each line - for i, line := range lines { - lines[i] = strings.TrimSpace(line) - } - - sort.Strings(lines) - tmp := strings.Join(lines, "\n") - tmp = strings.TrimLeft(tmp, "\n") - tmp = strings.TrimRight(tmp, "\n") - return tmp -} - -func (ls *LinuxStatus) SetSpeedActual(s string) { - if ! ls.Ready() {return} - ls.speedActual.Set(s) -} -- cgit v1.2.3