diff options
| author | Jeff Carr <[email protected]> | 2025-02-22 19:11:51 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-22 19:11:51 -0600 |
| commit | a72e9ce5f4062fb78c82f1380d7a86ee4cc47294 (patch) | |
| tree | 546112fe224fbaec50666a61d3ccab102081acc4 /ideas/timer.go | |
| parent | 3ab156a9c477f4d839e1384d424856519390b797 (diff) | |
NEVER LEAVE JUNK IN GO REPOS EVERv0.22.92v0.22.91v0.22.90v0.22.89v0.22.88v0.22.87v0.22.86v0.22.85v0.22.84v0.22.83v0.22.82v0.22.81v0.22.80v0.22.79v0.22.78v0.22.77v0.22.76v0.22.75v0.22.74v0.22.73v0.22.72v0.22.71v0.22.70v0.22.69v0.22.68v0.22.67v0.22.66v0.22.65v0.22.64v0.22.63v0.22.62v0.22.61v0.22.60v0.22.59
Diffstat (limited to 'ideas/timer.go')
| -rw-r--r-- | ideas/timer.go | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/ideas/timer.go b/ideas/timer.go deleted file mode 100644 index 3d18445..0000000 --- a/ideas/timer.go +++ /dev/null @@ -1,36 +0,0 @@ -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) -} - -func (rs *RepoStatus) setSpeed(duration time.Duration) { - s := fmt.Sprint(duration) - if rs.speedActual == nil { - log.Log(WARN, "rs.speedActual == nil") - return - } - rs.speedActual.SetValue(s) - - if duration > 200*time.Millisecond { - rs.speed.SetValue("SLOW") - } else if duration > 50*time.Millisecond { - rs.speed.SetValue("OK") - } else { - rs.speed.SetValue("FAST") - } -} |
