summaryrefslogtreecommitdiff
path: root/timer.go
blob: 380e4bb25aa5e65c31cefc61f7425a5e57543edf (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.SetText(s)
}