Discussion:
[Linuxptp-devel] [PATCH] phc2sys: Use CLOCK_MONOTONIC to time pmc updates.
Miroslav Lichvar
2014-06-20 14:25:01 UTC
Permalink
After moving the leap second check away from update_pmc(), the time
stamp is used only to control the pmc update interval. Switch to
CLOCK_MONOTONIC to keep the interval stable when CLOCK_REALTIME is
stepped.
---
phc2sys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/phc2sys.c b/phc2sys.c
index 87c1749..224c03e 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -1055,7 +1055,7 @@ static int update_pmc(struct node *node, int subscribe)
struct timespec tp;
uint64_t ts;

- if (clock_gettime(CLOCK_REALTIME, &tp)) {
+ if (clock_gettime(CLOCK_MONOTONIC, &tp)) {
pr_err("failed to read clock: %m");
return -1;
}
--
1.9.3
Richard Cochran
2014-06-22 07:59:04 UTC
Permalink
Post by Miroslav Lichvar
After moving the leap second check away from update_pmc(), the time
stamp is used only to control the pmc update interval. Switch to
CLOCK_MONOTONIC to keep the interval stable when CLOCK_REALTIME is
stepped.
Applied.

Thanks,
Richard

Loading...