MCPcopy Create free account
hub / github.com/diillson/chatcli / Elapsed

Method Elapsed

cli/metrics/timer.go:93–104  ·  view source on GitHub ↗

Elapsed retorna o tempo decorrido (funciona mesmo com timer rúdando)

()

Source from the content-addressed store, hash-verified

91
92// Elapsed retorna o tempo decorrido (funciona mesmo com timer rúdando)
93func (t *Timer) Elapsed() time.Duration {
94 t.mu.Lock()
95 defer t.mu.Unlock()
96
97 if t.running {
98 return time.Since(t.startTime)
99 }
100 if !t.stopTime.IsZero() {
101 return t.stopTime.Sub(t.startTime)
102 }
103 return 0
104}
105
106// IsRunning retorna se o timer está em execução
107func (t *Timer) IsRunning() bool {

Callers 1

Calls 3

LockMethod · 0.80
UnlockMethod · 0.80
IsZeroMethod · 0.80

Tested by 1