2024-01-09 15:34:53 -06:00
|
|
|
package repostatus
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
// timeFunction takes a function as an argument and returns the execution time.
|
|
|
|
func timeFunction(f func()) time.Duration {
|
2024-01-18 00:57:43 -06:00
|
|
|
startTime := time.Now() // Record the start time
|
|
|
|
f() // Execute the function
|
2024-01-09 15:34:53 -06:00
|
|
|
return time.Since(startTime) // Calculate the elapsed time
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ls *RepoStatus) SetSpeedActual(s string) {
|
2024-01-18 00:57:43 -06:00
|
|
|
if !ls.Ready() {
|
|
|
|
return
|
|
|
|
}
|
2024-01-19 12:36:52 -06:00
|
|
|
ls.speedActual.SetValue(s)
|
2024-01-09 15:34:53 -06:00
|
|
|
}
|