diff options
| author | Ian Lance Taylor <iant@golang.org> | 2020-12-10 15:01:20 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2020-12-10 23:24:38 +0000 |
| commit | e012d0dc34e0c182aed605347fb19c6980b3f8bd (patch) | |
| tree | 9d7d2572687aa994a4a85ec2e1114abfac991db7 /src/syscall/timestruct.go | |
| parent | 1fe891a937eae62ce396f3d7c7c6c472701acf0a (diff) | |
| download | go-e012d0dc34e0c182aed605347fb19c6980b3f8bd.tar.xz | |
syscall: drop references to Unix epoch in Timeval/Timespec docs
The various conversion functions just change the format of time values.
They don't use the Unix epoch. Although in practice the values are often
times since the Unix epoch, they aren't always, so referring to the
epoch can be confusing.
Fixes #43010
Change-Id: I640d665f0d2017f0974db05d70858037c7c91eda
Reviewed-on: https://go-review.googlesource.com/c/go/+/277073
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/syscall/timestruct.go')
| -rw-r--r-- | src/syscall/timestruct.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/syscall/timestruct.go b/src/syscall/timestruct.go index 682c68cf9b..bca51df08d 100644 --- a/src/syscall/timestruct.go +++ b/src/syscall/timestruct.go @@ -6,12 +6,10 @@ package syscall -// TimespecToNsec converts a Timespec value into a number of -// nanoseconds since the Unix epoch. +// TimespecToNSec returns the time stored in ts as nanoseconds. func TimespecToNsec(ts Timespec) int64 { return ts.Nano() } -// NsecToTimespec takes a number of nanoseconds since the Unix epoch -// and returns the corresponding Timespec value. +// NsecToTimespec converts a number of nanoseconds into a Timespec. func NsecToTimespec(nsec int64) Timespec { sec := nsec / 1e9 nsec = nsec % 1e9 @@ -22,12 +20,10 @@ func NsecToTimespec(nsec int64) Timespec { return setTimespec(sec, nsec) } -// TimevalToNsec converts a Timeval value into a number of nanoseconds -// since the Unix epoch. +// TimevalToNsec returns the time stored in tv as nanoseconds. func TimevalToNsec(tv Timeval) int64 { return tv.Nano() } -// NsecToTimeval takes a number of nanoseconds since the Unix epoch -// and returns the corresponding Timeval value. +// NsecToTimeval converts a number of nanoseconds into a Timeval. func NsecToTimeval(nsec int64) Timeval { nsec += 999 // round up to microsecond usec := nsec % 1e9 / 1e3 |
