Time Namespace
A namespace that allows setting offsets for CLOCK_MONOTONIC and CLOCK_BOOTTIME.
| Clock | What it represents | Notes |
|---|---|---|
CLOCK_MONOTONIC | Monotonically increasing elapsed time Time since boot | Not affected by manual time changes |
CLOCK_BOOTTIME | Monotonically increasing elapsed time Time since boot + suspend time | Not affected by manual time changes Continues counting during suspend |
CLOCK_REALTIME | Wall-clock time | Can jump due to manual time changes or NTP adjustments |
Use Cases
- Testing with different time settings
- Can be used to speed up tests that wait for timeouts
- Checkpoint with CRIU and restore on another node
- Timeouts may occur when an application resumes at a future time
- Reference: cri-o#8033
A similar feature called Virtual time was proposed in the past.
Usage
You can specify container time offsets using timeOffsets in OCI runtime-spec.
Write the offset from the initial time namespace to /proc/<pid>/timens_offsets.
Note
Applied from child processes onward
Warning
CLOCK_REALTIME cannot be changedyouki implementation