repostatus/timer.go

18 lines
430 B
Go
Raw Normal View History

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 {
startTime := time.Now() // Record the start time
f() // Execute the function
return time.Since(startTime) // Calculate the elapsed time
}
func (ls *RepoStatus) SetSpeedActual(s string) {
if ! ls.Ready() {return}
ls.speedActual.SetText(s)
2024-01-09 15:34:53 -06:00
}