Skip to content

Commit

Permalink
Fix incorrect casts of tai offsets.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidv1992 authored and rnijveld committed Feb 21, 2024
1 parent f81523e commit 8d0c38b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions statime-linux/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ async fn port_task<A: NetworkAddress + PtpTargetAddress>(
if let Some(mut timestamp) = packet.timestamp {
// get_tai gives zero if this is a hardware clock, and the needed
// correction when this port uses software timestamping
timestamp.seconds += clock.get_tai_offset().expect("Unable to get tai offset") as libc::time_t;
timestamp.seconds += clock.get_tai_offset().expect("Unable to get tai offset") as i64;
log::trace!("Recv timestamp: {:?}", packet.timestamp);
port.handle_event_receive(&event_buffer[..packet.bytes_read], timestamp_to_time(timestamp))
} else {
Expand Down Expand Up @@ -660,7 +660,7 @@ async fn ethernet_port_task(
if let Some(mut timestamp) = packet.timestamp {
// get_tai gives zero if this is a hardware clock, and the needed
// correction when this port uses software timestamping
timestamp.seconds += clock.get_tai_offset().expect("Unable to get tai offset") as libc::time_t;
timestamp.seconds += clock.get_tai_offset().expect("Unable to get tai offset") as i64;
log::trace!("Recv timestamp: {:?}", packet.timestamp);
port.handle_event_receive(&event_buffer[..packet.bytes_read], timestamp_to_time(timestamp))
} else {
Expand Down Expand Up @@ -757,7 +757,7 @@ async fn handle_actions<A: NetworkAddress + PtpTargetAddress>(
// get_tai gives zero if this is a hardware clock, and the needed
// correction when this port uses software timestamping
time.seconds +=
clock.get_tai_offset().expect("Unable to get tai offset") as libc::time_t;
clock.get_tai_offset().expect("Unable to get tai offset") as i64;
log::trace!("Send timestamp {:?}", time);
pending_timestamp = Some((context, timestamp_to_time(time)));
} else {
Expand Down

0 comments on commit 8d0c38b

Please sign in to comment.