diff --git a/clockadj.c b/clockadj.c index 0485d8c..7b8feef 100644 --- a/clockadj.c +++ b/clockadj.c @@ -182,3 +182,14 @@ void sysclk_set_sync(void) if (clock_adjtime(clkid, &tx) < 0) pr_err("failed to set clock status and maximum error: %m"); } + +void sysclk_set_unsync(void) +{ + clockid_t clkid = CLOCK_REALTIME; + struct timex tx; + memset(&tx, 0, sizeof(tx)); + tx.modes = ADJ_STATUS; + tx.status = STA_UNSYNC; + if (clock_adjtime(clkid, &tx) < 0) + pr_err("failed to set clock status: %m"); +} diff --git a/clockadj.h b/clockadj.h index 4ea98c1..8a98627 100644 --- a/clockadj.h +++ b/clockadj.h @@ -80,4 +80,9 @@ int sysclk_max_freq(void); * the real-time clock (RTC) to it. */ void sysclk_set_sync(void); + +/** + * Mark the system clock as unsynchronized. + */ +void sysclk_set_unsync(void); #endif diff --git a/phc2sys.c b/phc2sys.c index c0b7b3d..80d0b8e 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -735,8 +735,10 @@ static int do_loop(struct node *node, int subscriptions) reconfigure(node); } } - if (!node->master) + if (!node->master) { + sysclk_set_unsync(); continue; + } LIST_FOREACH(clock, &node->dst_clocks, dst_list) { if (!update_needed(clock))