Commit 32f011e4 authored by Russ Cox's avatar Russ Cox

syscall: add Timeval.Nano, Timespec.Nano, for conversion to Duration

Fixes #2534.

R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/5635051
parent fc06cadd
......@@ -37,3 +37,11 @@ func (ts *Timespec) Unix() (sec int64, nsec int64) {
func (tv *Timeval) Unix() (sec int64, nsec int64) {
return int64(tv.Sec), int64(tv.Usec) * 1000
}
func (ts *Timespec) Nano() int64 {
return int64(ts.Sec)*1e9 + int64(ts.Nsec)
}
func (tv *Timeval) Nano() int64 {
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment