Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeSynchronization #7

Open
5 tasks
icedream opened this issue Jul 14, 2021 · 5 comments
Open
5 tasks

TimeSynchronization #7

icedream opened this issue Jul 14, 2021 · 5 comments

Comments

@icedream
Copy link
Owner

  • Reveng'ing the protocol
  • PoC for protocol implementation
  • Drafting API
  • Restructuring PoC to conform with drafted API
  • Testing
@icedream icedream changed the title TimeSynchronisation TimeSynchronization Jul 14, 2021
@mhite
Copy link
Contributor

mhite commented Oct 3, 2022

Just poking around @honusz Stagelinq repo and saw this:

https://github.com/honusz/StageLinq/blob/beatinfo/services/TimeSync.ts

Seems to just be a service for getting the uptime of the device?

@honusz
Copy link

honusz commented Oct 3, 2022

Just poking around @honusz Stagelinq repo and saw this:

https://github.com/honusz/StageLinq/blob/beatinfo/services/TimeSync.ts

Seems to just be a service for getting the uptime of the device?

Oh, that was some remnant of some test exploring the service. I think I just copied beatinfo module over and was trying to get a response.

I've actually made a bit of progress with it, just haven't pushed the code up to Github.

I've been meaning to do a write-up about where I've gotten to, maybe if I get a chance tmw.

I think the service has something to do with either syncing clocks between devices, or determining latency.
When I push the proper code it will give a better idea. I'm like one step away from having it figured out, so I'm dying to get some input on it.

@mhite
Copy link
Contributor

mhite commented Oct 3, 2022

@honusz - Gotcha. Looking forward to seeing what you've discovered thus far!

@honusz
Copy link

honusz commented Oct 5, 2022

@mhite sorry, I haven't forgotten, just been a bit busy.

It seems like the exchange of messages goes something like this:

Device sends a message,
4 bytes - message length
4 bytes - 0x1 (could either be a code for a 'request' or just the number of following 8-byte fields
8 bytes - bigint of the device's clock. Not sure it has any real value, it's just a running clock.

The software (soundswitch or timecode) replies:

4 bytes - message length
4 bytes - 0x2
8 bytes - bigint that the device sent
8 bytes - bigint timestamp that it received the message at (Unix epoch in ms)

That's it really. The software sometimes reverses this by sending a request with its epoch-in-ms time back as the first 8-byte bigint field, and the device responds with the timestamp (using its clock) of when it received the message.

I suppose the simplest utility this has is just letting the players know what latency there is between them.

I need to play around with it a bit more, but I think you can make the clock shift, like, bring the two clocks together. This might be nonsense, and just the result of some mistakes I made in some test replies.
I'm trying to strip down the JS library a bit and make a more performant experimental version, where it'll be a bit easier to experiment with new features and things that require tighter timing.

@mhite
Copy link
Contributor

mhite commented Oct 5, 2022

@honusz - No problem -- this is great information and certainly enough for me to get started poking at this, too! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants