summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/syscalls/linux/sys_time.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/syscalls/linux/sys_time.go')
-rw-r--r--pkg/sentry/syscalls/linux/sys_time.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_time.go b/pkg/sentry/syscalls/linux/sys_time.go
index fe8725191..0f36e4cd0 100644
--- a/pkg/sentry/syscalls/linux/sys_time.go
+++ b/pkg/sentry/syscalls/linux/sys_time.go
@@ -121,8 +121,13 @@ func getClock(t *kernel.Task, clockID int32) (ktime.Clock, error) {
switch clockID {
case linux.CLOCK_REALTIME, linux.CLOCK_REALTIME_COARSE:
return t.Kernel().RealtimeClock(), nil
- case linux.CLOCK_MONOTONIC, linux.CLOCK_MONOTONIC_COARSE, linux.CLOCK_MONOTONIC_RAW:
+ case linux.CLOCK_MONOTONIC, linux.CLOCK_MONOTONIC_COARSE,
+ linux.CLOCK_MONOTONIC_RAW, linux.CLOCK_BOOTTIME:
// CLOCK_MONOTONIC approximates CLOCK_MONOTONIC_RAW.
+ // CLOCK_BOOTTIME is internally mapped to CLOCK_MONOTONIC, as:
+ // - CLOCK_BOOTTIME should behave as CLOCK_MONOTONIC while also including suspend time.
+ // - gVisor has no concept of suspend/resume.
+ // - CLOCK_MONOTONIC already includes save/restore time, which is the closest to suspend time.
return t.Kernel().MonotonicClock(), nil
case linux.CLOCK_PROCESS_CPUTIME_ID:
return t.ThreadGroup().CPUClock(), nil