From eecf69af48ba1b7b0c6478cfc42a5de92a214e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 23 Feb 2023 14:05:08 +0100 Subject: [PATCH] protocol: Make timestamps a single 64 bit argument With 64 bit integers on the wire, we don't need to split timestamps in milliseconds and microsecond parts. --- proto/protocol.xml | 6 ++---- src/libei-device.c | 6 +++--- src/libeis-device.c | 6 +++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/proto/protocol.xml b/proto/protocol.xml index 01b85b6..362657e 100644 --- a/proto/protocol.xml +++ b/proto/protocol.xml @@ -708,8 +708,7 @@ of an ei_connection_setup.context_type other than sender. - - + @@ -980,8 +979,7 @@ of an ei_connection_setup.context_type other than receiver. - - + diff --git a/src/libei-device.c b/src/libei-device.c index 35f8e1f..7ab3f5a 100644 --- a/src/libei-device.c +++ b/src/libei-device.c @@ -360,14 +360,14 @@ maybe_error_on_device_state(struct ei_device *device, const char *event_type) } static struct brei_result * -handle_msg_frame(struct ei_device *device, uint32_t serial, uint32_t time, uint32_t micros) +handle_msg_frame(struct ei_device *device, uint32_t serial, uint64_t time) { DISCONNECT_IF_SENDER_CONTEXT(device); ei_update_serial(ei_device_get_context(device), serial); if (device->state == EI_DEVICE_STATE_EMULATING) { - ei_queue_frame_event(device, ms2us(time) + micros); + ei_queue_frame_event(device, time); return NULL; } @@ -1620,7 +1620,7 @@ ei_device_frame(struct ei_device *device, uint64_t time) device->send_frame_event = false; - int rc = ei_device_request_frame(device, ei_get_serial(ei), us2ms(time), time % 1000); + int rc = ei_device_request_frame(device, ei_get_serial(ei), time); if (rc) ei_disconnect(ei_device_get_context(device)); return; diff --git a/src/libeis-device.c b/src/libeis-device.c index 773e042..e9b27ae 100644 --- a/src/libeis-device.c +++ b/src/libeis-device.c @@ -320,14 +320,14 @@ maybe_error_on_device_state(struct eis_device *device, const char *event_type) } static struct brei_result * -client_msg_frame(struct eis_device *device, uint32_t serial, uint32_t time, uint32_t micros) +client_msg_frame(struct eis_device *device, uint32_t serial, uint64_t time) { eis_client_update_client_serial(eis_device_get_client(device), serial); DISCONNECT_IF_RECEIVER_CONTEXT(device); if (device->state == EIS_DEVICE_STATE_EMULATING) { - eis_queue_frame_event(device, ms2us(time) + micros); + eis_queue_frame_event(device, time); return NULL; } @@ -1211,7 +1211,7 @@ eis_device_frame(struct eis_device *device, uint64_t time) device->send_frame_event = false; eis_device_event_frame(device, eis_client_get_next_serial(client), - us2ms(time), time % 1000); + time); } void