summaryrefslogtreecommitdiff
path: root/timer.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-21 02:23:47 -0600
committerJeff Carr <[email protected]>2024-01-21 02:23:47 -0600
commit433d83e63678e4483e1d8af2e522c7b05c7d7909 (patch)
tree7a6168fd19f27c5af9b241c45d0fe33ef9be21d7 /timer.go
parentfdac7e7b8944d51b8207c1797edd0be9450de7b8 (diff)
fix name changesv0.5.6
new gadgets correct go mod updated paths Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'timer.go')
-rw-r--r--timer.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/timer.go b/timer.go
index 17130f3..991961a 100644
--- a/timer.go
+++ b/timer.go
@@ -1,15 +1,15 @@
package linuxstatus
import (
- "time"
"sort"
"strings"
+ "time"
)
// 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
+ startTime := time.Now() // Record the start time
+ f() // Execute the function
return time.Since(startTime) // Calculate the elapsed time
}
@@ -31,6 +31,8 @@ func sortLines(input string) string {
}
func (ls *LinuxStatus) SetSpeedActual(s string) {
- if ! ls.Ready() {return}
- ls.speedActual.Set(s)
+ if !ls.Ready() {
+ return
+ }
+ ls.speedActual.SetValue(s)
}