From 150a46c0cb23ffea34089e69949731f2aaebdbe8 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 26 Oct 2017 10:10:25 +0200 Subject: [PATCH] syscall: document Time{spec,val} methods Add godoc comments for Time{spec,val} methods Unix and Nano. Change-Id: I285bbd236af588b30140db7182b05f8b202b5b0b Reviewed-on: https://go-review.googlesource.com/73271 Run-TryBot: Tobias Klauser Reviewed-by: Ian Lance Taylor --- src/syscall/syscall.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/syscall/syscall.go b/src/syscall/syscall.go index 1340f2aa00..01ba64819d 100644 --- a/src/syscall/syscall.go +++ b/src/syscall/syscall.go @@ -80,18 +80,24 @@ func BytePtrFromString(s string) (*byte, error) { // See mksyscall.pl. var _zero uintptr +// Unix returns ts as the number of seconds and nanoseconds elapsed since the +// Unix epoch. func (ts *Timespec) Unix() (sec int64, nsec int64) { return int64(ts.Sec), int64(ts.Nsec) } +// Unix returns tv as the number of seconds and nanoseconds elapsed since the +// Unix epoch. func (tv *Timeval) Unix() (sec int64, nsec int64) { return int64(tv.Sec), int64(tv.Usec) * 1000 } +// Nano returns ts as the number of nanoseconds elapsed since the Unix epoch. func (ts *Timespec) Nano() int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } +// Nano returns tv as the number of nanoseconds elapsed since the Unix epoch. func (tv *Timeval) Nano() int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 } -- 2.48.1