syscall: unify NsecToTime{spec,val}, fix for times < 1970
All the implementations of NsecToTimespec and NsecToTimeval were the same other than types. Write a single version that uses GOARCH/GOOS-specific setTimespec and setTimeval functions to handle the types. The logic in NsecToTimespec and NsecToTimeval caused times before 1970 to have a negative usec/nsec. The Linux kernel requires that usec contain a positive number; for consistency, we do this for both NsecToTimespec and NsecToTimeval. Change-Id: I525eaba2e7cdb00cb57fa00182dabf19fec298ae Reviewed-on: https://go-review.googlesource.com/30826 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
Showing
Please register or sign in to comment