good morning!!!!

Skip to content
Snippets Groups Projects
timer.go 273 B
Newer Older
a's avatar
rpc
a committed
package jrpc

import (
	"time"
)

type Timer struct {
	s time.Time
}

func NewTimer() *Timer {
	return &Timer{
		s: time.Now(),
	}
}

func (t *Timer) Since(...any) time.Duration {
a's avatar
a committed
	return time.Since(t.s)
a's avatar
rpc
a committed
}

func (t *Timer) Until() time.Duration {
a's avatar
a committed
	return time.Until(t.s)
a's avatar
rpc
a committed
}