diff options
Diffstat (limited to 'timer.go')
| -rw-r--r-- | timer.go | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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) } |
