Duration in Go

Posted by GoDoc
Public (Editable by Users)

A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years.

Go
Edit
package main

import (
	"fmt"
	"time"
)

func main() {
	t0 := time.Now()
	expensiveCall()
	t1 := time.Now()
	fmt.Printf("The call took %v to run.\n", t1.Sub(t0))
}