Is 'sleep' based on the system clock or on time elapsed?

For example, if you execute:

sleep 1200

And immediately suspend your system for 10 minutes, will it end in another 10 minutes, or will it continue to wait for the full 20 minutes?

  • 1
    I don't think suspending the system affects the system clock like that; perhaps a direct change of time would be a better example? Jul 2, 2019 at 20:49

1 Answer 1


Well I guess it was easy enough to test. After initiating a 5 minute sleep, I suspended the system for about 2 minutes. The answer?

Sleep is calculated using elapsed time of the process, not clock time.

date; sleep 300; date
Tue Jul  2 20:58:41 EDT 2019
Tue Jul  2 21:05:28 EDT 2019

This may have been predictable since man sleep(3) says:

System activity may lengthen the sleep by an indeterminate amount.

Which kind of implies the amount of time is internal to the sleep process.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .