summaryrefslogtreecommitdiff
path: root/timer.go
blob: 067a85a9b76af50c79243338225542886bb87d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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.SetValue(s)
}