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