Is there a way to get the unix epoch in miliseconds?

Post your awesome Wire patches here, share tutorials
Post Reply
User avatar
somnium
Posts: 7
Joined: Thu Nov 30, 2023 00:10

Is there a way to get the unix epoch in miliseconds?

Post by somnium »

I'm using two snapshot's to measure the time difference between received events and it's a little tedious at the moment as I need to manually calculate the "running milliseconds" from the System Time operator (millis + seconds * 1000 + minutes * 6000...).

Is there a better way to do this that I'm overlooking?

--begin-wire-patch--
1402.3oc6YsraiaCE8WoPqMC3KQQlc1ww.yhNcwDftXPPAkEkMakkb0iLimA4euWR4m0pxNicJx.jrHVh9PxKO2ygjl76ASKxyMSqsE4UA294uGjVVr.dPRFDTzTuroFG73ff5BWYrAA171hddvNnzdfRNDJePPkA5xjpcPC6tUAnKr4M0l8fJ5Fpni.Hp6.HrGnzNBfrL6QA7F7rivOunobOfxtCWYOwv+BZTGPgLSkcVtN6zPocCk0ATUmAfBeLTEYMzCQtUvrCHz8Npy5TWGBF9l5xFyACp5R6rYlxi.lpypLGLl1g7w0gxuUl.ue6mg2WXp0A298.cS87Bnrf.HJz0lYEkqf2LoofbGJKwrLqX0BSd8C5xYlZWchK04Sm2Vmb8BC7zuaKMvaOYJqbiB.zB8e5Z2Hu9z8DAx7K00tJhe9YWKWMsztzOp8MUhsZYld0GaawOsJepI4WF6KbpqwsIPTXSstgP.QpTJNlfLggJDGqvHE0vQZtdJOcZDKMMFpSlcpIuxLwlYZ6j0ErtSfBVnsYsOU.7kETAW7.UtcfRcCz+tQmYqAVkwkbHuTZpJxZpWW84F6r4PuQvRPE8EaRMTOhhhgZVoexbsil54MKhy2NnaJW+vSl7jVg..J2705OVjX9PRvsJvGjCOW4ZdIwKZpAsUreRG3MadUMDYsuTuZoKvr4fTBRTP6py.E7sjm2XxPsP1B0+wVbaqoKViKZbSorGK4z0a4HXVpuBeJv3ajLFMDJgQnPo.WSXL4MrPFMh.rNKJDZtoY5p1HFFVAQQBUDUDhRDgXDWmDihMgTTLFmJSi4BM9.tk3agho+ET2m.sXgywTj44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:08
Location: Székesfehérvár, Hungary

Re: Is there a way to get the unix epoch in miliseconds?

Post by Zoltán »

System time would show you the local system's time, and around midnight that would turn back to 0:00.000
If you need the unix epoch, there is a Date node too, which you can use to calculate, but it will still be all based on your local time zone.

What would you like to use the delta time for?
Software developer, Sound Engineer,
Control Your show with ”Enter” - multiple Resolume servers at once - SMPTE/MTC column launch
try for free: http://programs.palffyzoltan.hu

User avatar
somnium
Posts: 7
Joined: Thu Nov 30, 2023 00:10

Re: Is there a way to get the unix epoch in miliseconds?

Post by somnium »

Zoltán wrote: Wed Dec 13, 2023 18:38 System time would show you the local system's time, and around midnight that would turn back to 0:00.000
If you need the unix epoch, there is a Date node too, which you can use to calculate, but it will still be all based on your local time zone.
Yeah, every night at midnight it will break haha. In my case it's ok, but it's good to know there's the Date node if I need it for something where it won't.

I don't really need the unix epoch specifically, I just need a stable incrementing `ms` counter. Even something and incrementing time from transport would be enough.
Zoltán wrote: Wed Dec 13, 2023 18:38 What would you like to use the delta time for?
It's actually related to viewtopic.php?p=92548#p92548

Now that Wire is a thing, I decided to take a pass at replacing the "mixing" and UI component of my VJ system (that I had originally built in TouchDesigner) with Resolume.

Since I'll be mixing external patches (TouchDesigner, tooll3, Notch, etc.) with "local" patches in Resolume (e.g. Wire), I need everything to be tightly synced. My original plan was to use Ableton Link, but I need to be able to arbitrarily resync to align phrases/phase which is not possible at the moment. I'm typically working with modular/DJ performances where the phrase will be changed at the whim of the performer (especially common after improv breakdowns).

To work around this limitation, I have a small TD patch that sends/listens to the BPM and resync events from Arena over OSC. It maintains a parallel clock and phase, sending envelops/gates to both Arena and other external patches. Listening to resync/BPM changes this way has a small amount of latency that I'd like to compensate for (usually around 1-3 frames).

I'm also making detected BPM (among other audio analysis) available and controlling Resolume's BPM when it's over a certain confidence threshold (which also causes clock/phase drift due to messaging latency).
Screenshot 2023-12-14 082338.png
Screenshot 2023-12-14 082338.png (26.31 KiB) Viewed 35222 times
In order to detect drift, I compare the internal timing of the triggers from the TransportTick/TransportBeat operator in Wire, with the corresponding incoming OSC events. I send that delta back to TouchDesigner and use it to calculate a clock offset to align the phase of Touchdesigner with the phase in Resolume.

--begin-wire-patch--
2783.3oc6b01jZiiD9uBEe1Zhd2R4aXd4t8p51spKop8CyL0UFrYv2B1ygMI6ro3+90xlArwBiY.lWtJIUlXz7HYote5VsTKwO5NIINNbRVTRbZ2Oe6O5NcYxB3AN1oaxprGWk08dmtYIlhHPQoS5d+Zmcvfxdzeo+hvrvkjcPoNcihgJiqfVTuQEZmtSl4C8g46gUWCqTBOrL5gGBWVApo7Bn3cXc2zCphzs7a6YnpCzEJglXCMoJZUsNrK1pXPpOLxpsIgH1Hy2fiPj1FWF489RfRR1pMJudG0nX1fkWEqaSXYUwJZBKs5.iQZB7dRAFtIvGToQsoznGBMyFZ1gPK1gVe7dhzFZxgP6ZC8A62JanOX+laaTxODZss1tJZWbcpGgakkR1wlJg0Pw+9xnrvVhsr6lJUntUUdiXw.jHHVvB0OMbdguvpvwLaiQs811L1qQ.2glbPzkZaA8.bpx3IVwSZSuoD98rKEz5RFyv21HkT24.gZUwK3FYKLUSPZoNg3.JG.7hn3UYgkAKO.XK99IBW6BagnIvTaci4yip2wetFr8pgEJqYtoznGh8mWu0mkrZY4lUcfgnpodsA78ad92VF.SMlO4sQ4.zb32.1J9c+7O55uJaVB7a61Ez89YgOjr7I3SgSmBTdnrfvGmm7zhv3ru5u7gvLScFuzOdxL.0p3+HN46w.rXv3CJ32iVFBe5agKSMlK.1E9+GSy6lq7LOQ3Fi0LS8wqWadAoSVF8Xt40m61Kty2hBBS5TzA5DGFFj1IKoyL+uE1wOqy7P+zrN9cxB+yrUKC6DE2wONnTAfL4lNecVXm7WRm9aFS6ZowgcRCyLOcW2g4uk65diYjFk93b+m90hQxWgwX5iIKy57kmhm.+ZnWEmEMMxHJ65J4iG6qwHWhqDwILJROVpQjvogLsZrln8g5LOZRXbZ3nn4gER3MEr4c.ErvOZdwSIPHLQ.g3RIlIUEy+2U9yix.UK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bQvt2tgyoGv4EfQeBrR4K9n4meelx2QLz43D0FmfPOucWJPJvHtevXz3PAEMFimplNlC53y9r7uYO.a5zBhcp8WC4346gQC2LiCt.SmVtxyx5C6KV4Kw9OlNKo4Shhz8kdBSyYEuBGwTpa8odIL5G2iXJiiAmBZGk4eZGJV5TbXRo7C8fFq19v03.mJU+LryOJgcxTtejOuSsMpSbKi5D2xnNwsLpS7G0fNk5eZC+Q1FlJzeTrgedxoVZJWGN8zfyNJbXdwVZeuE9GTybW7630V99NU1R94E0Hky0Hd+9Lj2f9CQdCGQEXESziJu9Yx1RXi22pjae6YDb4kMG3eY03rk9SZJTz0EeEarZYwRRgOtJJ2qDzBKy+lWoXQiZ7MTFUvY5Jalf.a1adEiqkXyFF6z8uRLeuufuQRoLAmv0JhhSwbR06pws4e4XTb2FyWTTwWWB4Wk2ha0dwktt3N4UbiSyWQcwk0p317TbqKJNc+Emu4hSnawIfr3.lUbZTxS0edxkySxWdJixSmQ9VsmuMv46hTdj44Ssma3CZm+GTDazgM
--end-wire-patch--

My initial version was randomly having runaway sync issues because I made the incorrect assumption that the milliseconds output of the system time was outputting the whole time and not just the current second 🤦🏻.

There have been a couple other times when I wanted to detect the time between events (e.g. dynamically set the Duration for Smooth to the average time between the last few changes), but this is my primary usecase.

The final thing that comes to mind is the ISF operator's time input.

Sorry for the novel here, hopefully this clarifies things.

Zoltán
Team Resolume
Posts: 7483
Joined: Thu Jan 09, 2014 13:08
Location: Székesfehérvár, Hungary

Re: Is there a way to get the unix epoch in miliseconds?

Post by Zoltán »

The patch you have looks about as simple as it could be made.
There are buffer nodes like Stack which could get rid of the snapshot, but then reading the values of it would need more nodes.
Software developer, Sound Engineer,
Control Your show with ”Enter” - multiple Resolume servers at once - SMPTE/MTC column launch
try for free: http://programs.palffyzoltan.hu

User avatar
somnium
Posts: 7
Joined: Thu Nov 30, 2023 00:10

Re: Is there a way to get the unix epoch in miliseconds?

Post by somnium »

Zoltán wrote: Thu Dec 14, 2023 12:11 The patch you have looks about as simple as it could be made.
There are buffer nodes like Stack which could get rid of the snapshot, but then reading the values of it would need more nodes.
Gotcha.

Any chance you would reconsider an option to enable the Resync command while Link is active? Maybe behind a configuration option outlining that it's not recommended? Is there a technical limitation there or is it purely to follow the conventions of the spec?

Zoltán
Team Resolume
Posts: 7483
Joined: Thu Jan 09, 2014 13:08
Location: Székesfehérvár, Hungary

Re: Is there a way to get the unix epoch in miliseconds?

Post by Zoltán »

somnium wrote: Fri Dec 15, 2023 09:42 Any chance you would reconsider an option to enable the Resync command while Link is active?
We're looking into it.
Software developer, Sound Engineer,
Control Your show with ”Enter” - multiple Resolume servers at once - SMPTE/MTC column launch
try for free: http://programs.palffyzoltan.hu

User avatar
somnium
Posts: 7
Joined: Thu Nov 30, 2023 00:10

Re: Is there a way to get the unix epoch in miliseconds?

Post by somnium »

Zoltán wrote: Fri Dec 15, 2023 11:56 We're looking into it.
🎉

Post Reply