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

timetag format #15

Open
trackme518 opened this issue May 10, 2023 · 0 comments
Open

timetag format #15

trackme518 opened this issue May 10, 2023 · 0 comments

Comments

@trackme518
Copy link

trackme518 commented May 10, 2023

Hi, I am not getting proper timetag with OSC bundle. Sender timetag differs to recieved timetag() extracted from OSC message.

Minimal code example:

import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress myRemoteLocation;

void setup() {
  size(400, 400);
  frameRate(60);
  oscP5 = new OscP5(this, 12000);
  myRemoteLocation = new NetAddress("127.0.0.1", 12000);
}


void draw() {
  background(0);
}


void mousePressed() {
  OscBundle myBundle = new OscBundle();
  OscMessage myMessage = new OscMessage("/test");
  myMessage.add("abc");
  myBundle.add(myMessage);

  long ts = System.currentTimeMillis();
  println("timetag send: "+  setTimetag(ts)+" millis: "+ts);
  myBundle.setTimetag( System.currentTimeMillis() );
  oscP5.send(myBundle, myRemoteLocation);
}



// incoming osc message are forwarded to the oscEvent method.
void oscEvent(OscMessage theOscMessage) {
  println("timetag recieved : "+ theOscMessage.timetag()  );
}

long setTimetag(long theTime) {
  final long secsSince1900 = theTime / 1000;
  final long secsFractional = ((theTime % 1000) << 32) / 1000;
  long l = (secsSince1900 << 32) | secsFractional;
  return l;
}

This produces:
When creating the OSC message:
timetag: 7231581490502040551 millis: 1683733773069

When the message is recieved:
timetag : -1727627929977226265

Why there is a negative sign? In what format is the timetag? Why is it not the same when setting it?

Can you clarify please? Thanks!

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

1 participant