time.Since

The Go function that returns how much time has passed since a given moment, as a time.Duration.

In more detail

Pair it with time.Now() to measure how long work took. Go measures it with the monotonic clock, so it stays correct even if the wall clock is adjusted while the work runs.

Example

elapsed := time.Since(start)

Related terms

Taught in

References