summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/sys/unix/timestruct.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-01-20 10:31:18 +0100
committerValentin Rothberg <rothberg@redhat.com>2021-01-20 10:31:24 +0100
commit175fc3867a70dd5a0d5c0becdb828751ccd88e9c (patch)
tree4c63109005f9c1a83bdf6259cdb2b189b2cd99d8 /vendor/golang.org/x/sys/unix/timestruct.go
parent5e7262ddf595f9187d01e12f5dcee2fe1c713798 (diff)
downloadpodman-175fc3867a70dd5a0d5c0becdb828751ccd88e9c.tar.gz
podman-175fc3867a70dd5a0d5c0becdb828751ccd88e9c.tar.bz2
podman-175fc3867a70dd5a0d5c0becdb828751ccd88e9c.zip
Revert "ginkgo: install on demand via `go get -u`"
This reverts commit de05e5816869073600ae8e851093b4b9a9d7fab0. Running `go get -u` will change the local Go module causing CI to fail as the local git tree is being changed. Reverting the change for now until we have a better idea. Signed-off-by: Valentin Rothberg <rothberg@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, 16 insertions, 10 deletions
diff --git a/vendor/golang.org/x/sys/unix/timestruct.go b/vendor/golang.org/x/sys/unix/timestruct.go
index 103604299..4a672f569 100644
--- a/vendor/golang.org/x/sys/unix/timestruct.go
+++ b/vendor/golang.org/x/sys/unix/timestruct.go
@@ -8,10 +8,12 @@ package unix
import "time"
-// TimespecToNSec returns the time stored in ts as nanoseconds.
-func TimespecToNsec(ts Timespec) int64 { return ts.Nano() }
+// 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) }
-// NsecToTimespec converts a number of nanoseconds into a Timespec.
+// NsecToTimespec takes a number of nanoseconds since the Unix epoch
+// and returns the corresponding Timespec value.
func NsecToTimespec(nsec int64) Timespec {
sec := nsec / 1e9
nsec = nsec % 1e9
@@ -40,10 +42,12 @@ func TimeToTimespec(t time.Time) (Timespec, error) {
return ts, nil
}
-// TimevalToNsec returns the time stored in tv as nanoseconds.
-func TimevalToNsec(tv Timeval) int64 { return tv.Nano() }
+// 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 }
-// NsecToTimeval converts a number of nanoseconds into a Timeval.
+// NsecToTimeval takes a number of nanoseconds since the Unix epoch
+// and returns the corresponding Timeval value.
func NsecToTimeval(nsec int64) Timeval {
nsec += 999 // round up to microsecond
usec := nsec % 1e9 / 1e3
@@ -55,22 +59,24 @@ func NsecToTimeval(nsec int64) Timeval {
return setTimeval(sec, usec)
}
-// Unix returns the time stored in ts as seconds plus nanoseconds.
+// 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 the time stored in tv as seconds plus nanoseconds.
+// 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 the time stored in ts as nanoseconds.
+// 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 the time stored in tv as nanoseconds.
+// 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
}