• Tobias Klauser's avatar
    unix: unify NsecToTime{spec,val}, fix for times < 1970 · e8259736
    Tobias Klauser authored
    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.
    
    Follow CL 30826 which did the same for syscall.
    
    Change-Id: Id6c6f4fef8450251447d1a5b01f35c2a36b5aeb1
    Reviewed-on: https://go-review.googlesource.com/73170
    Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    e8259736