Duration.Nanoseconds in Go

Posted by GoDoc
Last Edited by yhuang
Public (Editable by Users)

Nanoseconds returns the duration as an integer nanosecond count.

Go
Edit
package main

import (
	"fmt"
	"time"
)

func main() {
	u, _ := time.ParseDuration("1µs")
	fmt.Printf("One microsecond is %d nanoseconds.\n", u.Nanoseconds())
}