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

Change Timestamp #263

Open
LePtitMetalleux opened this issue Apr 7, 2022 · 1 comment
Open

Change Timestamp #263

LePtitMetalleux opened this issue Apr 7, 2022 · 1 comment

Comments

@LePtitMetalleux
Copy link

Hi, I got theses data :
{ "timeStamp": 520, "src": [ { "x": 0.896, "y": 0.376, "z": 0.235, "E": 0.317 }, { "x": 0.990, "y": 0.073, "z": 0.117, "E": 0.116 }, { "x": 0.758, "y": 0.637, "z": 0.140, "E": 0.088 }, { "x": 0.819, "y": 0.335, "z": 0.465, "E": 0.000 } ] }
I would like to know if it's possible to change
"timeStamp": 520,
to
"timeStamp": currentDate,

Thanks in advance

@SeanTasker
Copy link

SeanTasker commented Sep 3, 2024

The timestamp is the hop number.

In the code consuming this output you can do the following if you're using JavaScript:

var start = new Date(...); // Source from when you started
...
var timeStampFromStartMS = ( (timestamp * hopSize) / sampleRate ) * 1000 );
var currentTimestamp = new Date( startDateTime.getTime() + timeStampFromStartMS);

This isn't super precise since the start time isn't reported from ODAS in this situation.

Alternatively you could modify https://github.com/introlab/odas/blob/master/src/sink/snk_tracks.c#L348 to do a similar calculation and add it to the Unix epoch, see https://stackoverflow.com/a/10889489

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

2 participants