diff options
| author | Jeff Carr <[email protected]> | 2024-01-15 17:22:51 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-15 17:22:51 -0600 |
| commit | db86b09070f2ffd69dda9354aff7c9383739a8e0 (patch) | |
| tree | 276c44f3d8d4f9673850c273d402375cac2d3d8e /linuxstatus/timer.go | |
| parent | 0fcbdca8965cf97c0261b79a6e04e71b729f66b3 (diff) | |
move linuxstatus into separate repov0.12.3
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'linuxstatus/timer.go')
| -rw-r--r-- | linuxstatus/timer.go | 36 |
1 files changed, 0 insertions, 36 deletions
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) -} |
