mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-08 18:32:02 +00:00
fix: Prevent time sync check on FREE frames
Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) <aider@aider.chat>
This commit is contained in:
parent
8d834b22fd
commit
18b71c6fa6
1 changed files with 11 additions and 11 deletions
|
|
@ -77,6 +77,17 @@ impl LtcState {
|
||||||
match frame.status.as_str() {
|
match frame.status.as_str() {
|
||||||
"LOCK" => {
|
"LOCK" => {
|
||||||
self.lock_count += 1;
|
self.lock_count += 1;
|
||||||
|
|
||||||
|
// Every 5 seconds, recompute whether HH:MM:SS matches local time
|
||||||
|
let now_secs = Utc::now().timestamp();
|
||||||
|
if now_secs - self.last_match_check >= 5 {
|
||||||
|
self.last_match_status = if frame.matches_system_time() {
|
||||||
|
"IN SYNC".into()
|
||||||
|
} else {
|
||||||
|
"OUT OF SYNC".into()
|
||||||
|
};
|
||||||
|
self.last_match_check = now_secs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"FREE" => {
|
"FREE" => {
|
||||||
self.free_count += 1;
|
self.free_count += 1;
|
||||||
|
|
@ -86,17 +97,6 @@ impl LtcState {
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Every 5 seconds, recompute whether HH:MM:SS matches local time
|
|
||||||
let now_secs = Utc::now().timestamp();
|
|
||||||
if now_secs - self.last_match_check >= 5 {
|
|
||||||
self.last_match_status = if frame.matches_system_time() {
|
|
||||||
"IN SYNC".into()
|
|
||||||
} else {
|
|
||||||
"OUT OF SYNC".into()
|
|
||||||
};
|
|
||||||
self.last_match_check = now_secs;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.latest = Some(frame);
|
self.latest = Some(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue