summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/time
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2019-06-22 13:28:21 -0700
committergVisor bot <gvisor-bot@google.com>2019-06-22 13:29:26 -0700
commit35719d52c7ac7faa87b610013aedd69ad5d99ecc (patch)
tree32b3c190890687b6b1bc9b2af4d2575e474f9b52 /pkg/sentry/kernel/time
parentc1761378a93f8d596d7956c9b7ba2a9d3d0619bc (diff)
Implement statx.
We don't have the plumbing for btime yet, so that field is left off. The returned mask indicates that btime is absent. Fixes #343 PiperOrigin-RevId: 254575752
Diffstat (limited to 'pkg/sentry/kernel/time')
-rw-r--r--pkg/sentry/kernel/time/time.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/time/time.go b/pkg/sentry/kernel/time/time.go
index 9c3c05239..aa6c75d25 100644
--- a/pkg/sentry/kernel/time/time.go
+++ b/pkg/sentry/kernel/time/time.go
@@ -142,6 +142,11 @@ func (t Time) Timeval() linux.Timeval {
return linux.NsecToTimeval(t.Nanoseconds())
}
+// StatxTimestamp converts Time to a Linux statx_timestamp.
+func (t Time) StatxTimestamp() linux.StatxTimestamp {
+ return linux.NsecToStatxTimestamp(t.Nanoseconds())
+}
+
// Add adds the duration of d to t.
func (t Time) Add(d time.Duration) Time {
if t.ns > 0 && d.Nanoseconds() > math.MaxInt64-int64(t.ns) {