phc2sys: Notify kernel if clock is not in sync
In case there is no connection to the server, notify the kernel that the clock is currently unsynchronized. Signed-off-by: Ville Heikkinen <ville.heikkinen@nokia.com>master
parent
0a4d85c2ed
commit
944f5f7ac6
11
clockadj.c
11
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");
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue