Standard library / time

time.Duration.Nanoseconds()

Return the underlying signed nanosecond count. Expected stdout: '2000\n'.

Formal Syntax & Structure

go syntaxgo
func (d Duration) Nanoseconds() int64

Return Value

int64

Return the underlying signed nanosecond count.

Working Example

Example Snippetgo
package main
import (  "fmt"  "time")
func main() { fmt.Println((2 * time.Microsecond).Nanoseconds()) }
Go Reference