Moved offset calulation to happen every incoming packet

master
noah metz 2024-01-22 13:50:37 -07:00
parent 4ddef293bc
commit 9c7a6aaa01
1 changed files with 2 additions and 5 deletions

@ -617,6 +617,8 @@ impl TMClient {
let data = incoming[0..read].to_vec();
match BackendPacket::from_bytes(data) {
Some(packet) => {
let offset = packet.timestamp - get_float_time();
self.time_offset = offset.clone();
self.last_seq_num = packet.seq_num;
match packet.msg_type {
// Notice Message
@ -643,11 +645,6 @@ impl TMClient {
match BackendMessage::from_bytes(packet.data.clone()) {
Some(message) => {
log::debug!("Received response: {:#?}", message);
let offset = packet.timestamp - get_float_time();
self.time_offset = offset.clone();
log::info!("New offset: {}", offset);
log::info!("Server Timetamp: {}", packet.timestamp);
log::info!("Local Timetamp: {}", get_float_time());
match self.responses.send((Box::new(message), offset)) {
Ok(_) => log::debug!("Forwarded response to callback engine"),