mirror of
https://github.com/golang/go
synced 2024-11-24 22:57:57 -07:00
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
This commit is contained in:
parent
fc06cadd88
commit
32f011e46b
@ -37,3 +37,11 @@ func (ts *Timespec) Unix() (sec int64, nsec int64) {
|
|||||||
func (tv *Timeval) Unix() (sec int64, nsec int64) {
|
func (tv *Timeval) Unix() (sec int64, nsec int64) {
|
||||||
return int64(tv.Sec), int64(tv.Usec) * 1000
|
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
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user