Discussion:
[chrony-users] Is there any timer or sleep function in linux that is not influenced by chrony?
xxhdx1985126
2017-09-05 04:12:32 UTC
Permalink
Hi, everyone.


I need to make a thread sleep for some amount of time which is influenced by "chrony's speeding up the system clock", is there any way?


Thanks:-)
Bill Unruh
2017-09-05 05:15:00 UTC
Permalink
Post by xxhdx1985126
Hi, everyone.
I need to make a thread sleep for some amount of time which is influenced by "chrony's speeding up the system clock", is there
any way?
I would guess that you forgot a NOT in that sentence.
But you also seem to have a totally unwarrented faith in what the sleep or
nanosleep functions do. Once you learn that perhaps you will want to rethink
your question.
Post by xxhdx1985126
Thanks:-)
 
xxhdx1985126
2017-09-05 07:36:44 UTC
Permalink
Thanks for your reply:-)


I've got admit that I don't know what the sleep or nanosleep functions do, and I'll go into it right away.
On the other hand, could you give some hint about how chrony speeds up/slow down the system clock? I'm asking this because I have some kind of urgent need and I might not have time to read the chrony's source code.


Thanks very muck:-)
Post by Bill Unruh
Post by xxhdx1985126
Hi, everyone.
I need to make a thread sleep for some amount of time which is influenced by "chrony's speeding up the system clock", is there
any way?
I would guess that you forgot a NOT in that sentence.
But you also seem to have a totally unwarrented faith in what the sleep or
nanosleep functions do. Once you learn that perhaps you will want to rethink
your question.
Post by xxhdx1985126
Thanks:-)
Miroslav Lichvar
2017-09-11 09:17:29 UTC
Permalink
Post by xxhdx1985126
I need to make a thread sleep for some amount of time which is influenced by "chrony's speeding up the system clock", is there any way?
Linux provides the CLOCK_MONOTONIC_RAW clock, which is not influenced
by the chronyd's adjustments of the CLOCK_REALTIME/CLOCK_MONOTONIC
clock.

Unfortunately, it cannot be used in clock_nanosleep() or in a timer.
You would need to make your own timer using clock_gettime() and a busy
loop or sleep in short intervals with another clock.
--
Miroslav Lichvar
--
To unsubscribe email chrony-users-***@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-***@chrony.tuxfamily.org
with "help" in the subject.
Trouble? Email ***@chrony.tuxfamily.org.
Loading...