summaryrefslogtreecommitdiffhomepage
path: root/pkg/abi/linux/time.go
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/abi/linux/time.go
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/abi/linux/time.go')
-rw-r--r--pkg/abi/linux/time.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/abi/linux/time.go b/pkg/abi/linux/time.go
index fa9ee27e1..e727066d7 100644
--- a/pkg/abi/linux/time.go
+++ b/pkg/abi/linux/time.go
@@ -226,3 +226,18 @@ type Tms struct {
// TimerID represents type timer_t, which identifies a POSIX per-process
// interval timer.
type TimerID int32
+
+// StatxTimestamp represents struct statx_timestamp.
+type StatxTimestamp struct {
+ Sec int64
+ Nsec uint32
+ _ int32
+}
+
+// NsecToStatxTimestamp translates nanoseconds to StatxTimestamp.
+func NsecToStatxTimestamp(nsec int64) (ts StatxTimestamp) {
+ return StatxTimestamp{
+ Sec: nsec / 1e9,
+ Nsec: uint32(nsec % 1e9),
+ }
+}