summaryrefslogtreecommitdiff
path: root/timer.go
diff options
context:
space:
mode:
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)
}