summaryrefslogtreecommitdiffhomepage
path: root/pkg/abi/linux/time.go
diff options
context:
space:
mode:
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),
+ }
+}