In this post, I would like to share the scenarios when the clock status will be set STA_UNSYNC.
Scenario-1) When the kernel initializes on boot, it starts as UNSYNC. Upon starting NTP client, it can unset if it’s correctly synced. But if NTPD or NTP client never succeeds it stays as UNSYNC.
Scenario-2) When ntp_clear function was called. The kernel function makes it reset the internal NTP state. It sets both time_esterror and time_maxerror to 16 million and sets STA_UNSYNC
Scenario-3) Every second, when the nanosecond count overflows 1 billion, the second_overflow function increases time_maxerror by 500units. This represents the maximum amount of error that could possibly be present on a reasonable clock. If ntpd is running, it will constantly battle this growing max error by speeding or slowing the clock and lowering the maxerror counter. If it isn’t working, maxerror will eventually max out at 16 million and the second_overflow will freeze it at 16million and set UNSYNC.