open-ephys-plugins / zmq-interface

Streams continuous data, events, and spikes via ZeroMQ
GNU General Public License v3.0
4 stars 6 forks source link

Saving timestamp in message header #5

Open yusenz opened 1 year ago

yusenz commented 1 year ago

Just a small request, for latency measurement purposes in real time applications, can we have a timestamp in the header? Like, take a unix timestamp at creating c_obj for header and put it into a timestamp field in the header. Also, would it be possible to take another timestamp after the message is sent to see how long it takes on the sending side to send the message and log it somewhere? I am assuming the sending on zeromq is efficient but it would be better to check it as well. Maybe we can store this timestamp and send it in the next message?

anjaldoshi commented 1 year ago

Hi Yusen,

I just pushed out a new release for the plugin (0.3.2) that adds the current unix timestamp in milliseconds to all message headers. If you're sending messages between machines, you'll need an independent way of determining the offset between the two system clocks. I also fixed a bug that was causing the plugin to not bind to zmq sockets properly when reloading a signal chain.
The new version should be be available to download via Plugin Installer in a few minutes. Let me know if you have any other questions.

yusenz commented 1 year ago

Thanks! I will test it soon.

anjaldoshi commented 1 year ago

Cool! Fyi, the timestamp field is a part of the header along-side message_num and type for consistency across continuous, event and spike messages. https://github.com/open-ephys-plugins/zmq-interface/commit/8f6d8b1.