1

I'm using coreutils 8.13 and want to use the timeout command in combination with a python subprocess. If the system clock is changed during a long running call, will the timeout command work as expected? In other words, does the timeout command use absolute time (affected by changing system clock) or relative time (unaffected by changing system clock)?

Edit: After some digging, I've narrowed down that the answer is dependent on the behavior of "alarm" in unistd.h. Still digging through source...please save me.

Edit2: Older version of coreutils (<8.13) use alarm(2) with ITIMER_REAL to timeout. Newer versions (>=8.13) use timer_create(2) with CLOCK_REALTIME to timeout. This post tells me that my implementation should be affected by system clock changes. However, it is not. A simple test using a python script running a while loop shows me that changing the system clock does not affect the timeout. ???

Community
  • 1
  • 1
user1777820
  • 728
  • 9
  • 29

1 Answers1

0

Adjustments to the CLOCK_REALTIME clock have no effect on relative timers based on that clock.

At least, according to this answer of this somewhat similar question.

Community
  • 1
  • 1
system PAUSE
  • 37,082
  • 20
  • 62
  • 59