clock/math/add bug?

I’m sure the answer is straightforward but I can’t see it.

I’m attaching a component which basically starts with a clock chop, then does a multiplication to year/month/day chans etc. then adds them all together. Including the seconds channel which of course changes once a second.

Yet, when I look at the results, I don’t see the number changing once a second. It only updates every now and then. In my real toe file I feed that to a text top, and it’s the same (i.e. it’s not a display bug).

I feel like I’m missing something obvious, and yet… I can’t see it! Maybe it’s a real bug?

dani
base2.tox (782 Bytes)

think it’s a double precision issue. chops store their data as floats and those just can’t handle numbers that large

that’s what I thought…

but I do need a unique ID at every moment in time… and the first thing that came into my mind is of course “time” (usually number of secs since 1900 or whatever start date an OS reports it from).

anyway to get that from within Touch? I do not want to have a system call…

$AF counts up forever. Ofcourse if you put it into a CHOP you’ll get truncated due to precision again.
Inside scripts everything is a 64-bit float though, parameters too, so those won’t truncated it.

does $AF start at 0 when the session starts? If so, there’s a small (very small, but not small enough) that I would get the same ID in two different sessions.

If it does start with each session, then what else could I use? If not, and it’s absolute time,
then great, I’ll see if I can get it to work keeping precision in mind.

thanks!
d

It’ll start at 1 with each new session.

In the next build you can set TOUCH_ABSOLUTE_FRAME before startup to control the value that $AF starts at.

how do you use that ID? In a script, in CHOPs, …? could it be a string instead of a number?

yes it could be a string - I just need to store unique ID in some DATs.

dani

not sure if applicable to your case, but maybe you can just grab the clock output and “sequence” it’s channels in a DAT like this:

year:month:day:hour:min:sec:msec

this is unique, you can use a strcmp to check it against other IDs and if you really need it’s elements you just split them up again …