finding non-realtime values between events (not timer)
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?
Can you post that bit of your patch? Probably something you can do with storing the value, sprintf, and maybe translate i’m guessing.
[- ] ?
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.)
----------begin_max5_patcher---------- 987.3oc0Y1sbhBCEG+Z8oHCWss01I4jDD7t84vkYGTYsrq7wH3T61ou6KIAZ stwknDXs0onIv.+4GmuxgWFOxYQ19nBGzLzbznQuLdzH4ThIFUOdjSR39kaB KjGlSZzSYK9oyD0tJi1WJmtLq34jEYaZ1Q7J4zUG58LnYxejkVlFlDI20W2F G91gmtKINcSTo7ZPpmLOrb4iwoq+91nkkJMRbwOfmf77Da49hsP0LnfCtBEw +VdEHP0te6zmsq73yuZpxmyiTmbGGTfXOuNdrXyDCIRRTQQ35n+BIDXFAmmf v7BMTg5elTA9GTwGj7vUxFIgHd+moxIrSv5PwT6gB.Xpae4WT3AtUsPhSKsJ NJh1ToBcLw09LQ46vwWlWCbJlrHLcsyjK1NYWxhns5H.2dgMpI.GTQOHVl.B qhI0fvlVG2g7bYXstLfEMOTQSY0AUYVNnp0cYx2DWhvmFMjyDMzVsaXtxu7n 8icisIz85nB15wSXrl3IW2wXi0fCvlobT4cYD2OEobJQwUeVnCJtVOhKUkGl egQboF34zKAd0QGt08fnpLxD50tKjVdvrOOnRW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