aboutsummaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/sys/unix/timestruct.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2021-01-21 15:03:16 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2021-01-22 08:08:25 +0100
commit37319dec1771aaa9764c81359f439e862f45d8e1 (patch)
tree5b82653228c39df5a7ebcf9332db9e248ed1ef5a /vendor/golang.org/x/sys/unix/timestruct.go
parent6fd83de31dab0c60932972c6b26f68fa0bd1871f (diff)
downloadpodman-37319dec1771aaa9764c81359f439e862f45d8e1.tar.gz
podman-37319dec1771aaa9764c81359f439e862f45d8e1.tar.bz2
podman-37319dec1771aaa9764c81359f439e862f45d8e1.zip
vendor: update rootlesskit to v0.12.0
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'vendor/golang.org/x/sys/unix/timestruct.go')
-rw-r--r--vendor/golang.org/x/sys/unix/timestruct.go26
1 files changed, 10 insertions, 16 deletions
diff --git a/vendor/golang.org/x/sys/unix/timestruct.go b/vendor/golang.org/x/sys/unix/timestruct.go
index 4a672f569..103604299 100644
--- a/vendor/golang.org/x/sys/unix/timestruct.go
+++ b/vendor/golang.org/x/sys/unix/timestruct.go
@@ -8,12 +8,10 @@ package unix
import "time"
-// TimespecToNsec converts a Timespec value into a number of
-// nanoseconds since the Unix epoch.
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
+// 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
@@ -42,12 +40,10 @@ func TimeToTimespec(t time.Time) (Timespec, error) {
return ts, nil
}
-// TimevalToNsec converts a Timeval value into a number of nanoseconds
-// since the Unix epoch.
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
+// 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
@@ -59,24 +55,22 @@ func NsecToTimeval(nsec int64) Timeval {
return setTimeval(sec, usec)
}
-// Unix returns ts as the number of seconds and nanoseconds elapsed since the
-// Unix epoch.
+// Unix returns the time stored in ts as seconds plus nanoseconds.
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.
+// Unix returns the time stored in tv as seconds plus nanoseconds.
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.
+// Nano returns the time stored in ts as nanoseconds.
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.
+// Nano returns the time stored in tv as nanoseconds.
func (tv *Timeval) Nano() int64 {
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
}