Forums > MaxMSP

finding non-realtime values between events (not timer)

Aug 10 2010 | 6:00 pm

I have a program that is generating h:m:s GMT when an event occurs. I am using [timer] to time the (realtime) seconds between events. That works fine.

The problem I’m having is when going through the data "offline". [timer] then outputs the value between events that I generate manually. So for testing this method is useless.

So here’s the question: My program provides me with (for example) 12:10pm 05s. The next value is 11:13pm 54s. How can I find the seconds value between them?

Aug 10 2010 | 11:01 pm

Can you post that bit of your patch? Probably something you can do with storing the value, sprintf, and maybe translate i’m guessing.

Aug 11 2010 | 9:09 pm

[- ] ?

Aug 12 2010 | 2:00 am

My first question would be, why not store the time between events (which you say you’re measuring with timer as the events occur in real time) as part of your data set, instead of storing only the GMT?

You could also use the ‘ticks’ message to the date object when you first record the events, and store that info, which would be accurate to the nearest 1/60 of a second.

But if you’re somehow in a situation where the only information you have is the GMT in the format you describe, you should use regexp to parse out the numbers and the am/pm info, then do the proper math to convert that to seconds, then subtract it from the previous time (as Roman suggests). Here’s an example to get you started. (It only works for delta times up to 24 hours — 86400 seconds — because you don’t include date info in your GMT data.)

-- Pasted Max Patch, click to expand. --

Viewing 4 posts - 1 through 4 (of 4 total)

Forums > MaxMSP