Hello,
Attached is a stopwatch, derived from [maketime], that doesn't pollute the symbol table (i.e., indefinitely leak memory), thanks to Frank B.'s idea for keeping the symbols re-usable.
It has one-second grain, so it does not keep track of partial seconds between stops and restarts-with-no-reset. However, it is quite accurate after resets and when first started. I learned that metro sends an immediate bang when started -- something I had never paid attention to before. So [ps-stopwatch] always skips the first bang out of [metro] (after reset) so that it isn't one second ahead. It counts up to 99 hours, 59 minutes, and 59 seconds, then wraps back to zero.
It would be easy to make this a finer-grain stopwatch, down to the inherent resolution of [metro]. However, for my purposes (timing of live performance) one-second grain is quite adequate, and not too CPU-hungry.
Thanks again to Frank for this elegant solution.
Phil Stone www.pkstonemusic.com
#N canvas 788 73 452 547 10; #X obj 1 1 cnv 15 32 30 empty $0-hours empty 5 15 0 24 -1 -241291 0; #X obj 34 1 cnv 15 46 30 empty $0-minutes :01 3 15 0 24 -1 -241291 0; #X obj 80 1 cnv 15 77 30 empty $0-seconds :58 0 15 0 24 -1 -241291 0; #X obj 163 1 loadbang; #X obj 144 10 bng 12 250 50 0 $0-reset empty empty 17 7 0 10 -262144 -1 -1; #X obj 17 126 f 0; #X msg 208 488 label $1; #X obj 208 515 s $0-hours; #X msg 279 488 label $1; #X obj 279 515 s $0-minutes; #X msg 360 488 label $1; #X obj 360 515 s $0-seconds; #X obj 307 149 symbol :--; #X obj 297 173 symbol --; #X obj 16 255 f 0; #X obj 46 255 + 1; #X obj 16 281 mod 60; #X obj 16 333 f 0; #X obj 46 333 + 1; #X obj 16 354 mod 60; #X obj 16 307 select 0; #X obj 80 306 makefilename :%02d; #X obj 82 383 makefilename :%02d; #X obj 16 413 f 0; #X obj 46 413 + 1; #X obj 16 383 select 0; #X obj 16 434 mod 99; #X obj 82 458 makefilename %2d; #X text 265 10 goes up to 99 hours , then; #X text 266 24 wraps back to zero.; #X msg 53 126 0; #X obj 176 23 r $0-reset; #X msg 130 199 0; #X obj 16 228 spigot 0; #X msg 84 181 0; #X obj 17 181 t b a; #X msg 17 204 1; #X obj 215 252 symbol 0; #X obj 225 273 symbol :00; #X obj 215 200 spigot 0; #X obj 163 48 t b b b b b b; #X msg 250 172 0; #X msg 220 172 1; #X obj 215 224 t b b; #X obj 173 173 sel 1; #X text 265 57 doesn't remember partial; #X text 265 71 seconds between restarts; #X obj 17 154 metro 1000; #X obj 125 8 tgl 17 0 $0-onoff $0-r-onoff empty 17 7 0 10 -24198 -1 -262144 1 1; #X obj 355 292 s $0-r-onoff; #X msg 355 267 color $1 0; #X msg 354 243 13; #X msg 384 243 16; #X obj 16 34 r $0-onoff; #X obj 83 125 sel 0; #X obj 16 57 t f f f; #X obj 16 82 s $0-color; #X obj 354 196 r $0-color; #X obj 354 219 sel 0 1; #X text 41 202 skip 1st bang; #X connect 3 0 40 0; #X connect 5 0 44 0; #X connect 5 0 47 0; #X connect 6 0 7 0; #X connect 8 0 9 0; #X connect 10 0 11 0; #X connect 12 0 10 0; #X connect 12 0 8 0; #X connect 13 0 6 0; #X connect 14 0 16 0; #X connect 15 0 14 1; #X connect 16 0 15 0; #X connect 16 0 20 0; #X connect 16 0 21 0; #X connect 17 0 19 0; #X connect 18 0 17 1; #X connect 19 0 18 0; #X connect 19 0 22 0; #X connect 19 0 25 0; #X connect 20 0 17 0; #X connect 21 0 10 0; #X connect 22 0 8 0; #X connect 23 0 26 0; #X connect 24 0 23 1; #X connect 25 0 23 0; #X connect 26 0 24 0; #X connect 26 0 27 0; #X connect 27 0 6 0; #X connect 30 0 47 0; #X connect 31 0 40 0; #X connect 32 0 15 0; #X connect 32 0 18 0; #X connect 32 0 24 0; #X connect 33 0 14 0; #X connect 34 0 33 1; #X connect 35 0 36 0; #X connect 35 1 33 0; #X connect 36 0 33 1; #X connect 37 0 6 0; #X connect 37 0 8 0; #X connect 38 0 10 0; #X connect 39 0 43 0; #X connect 40 0 5 0; #X connect 40 1 32 0; #X connect 40 2 13 0; #X connect 40 2 12 0; #X connect 40 3 34 0; #X connect 40 4 42 0; #X connect 40 5 30 0; #X connect 41 0 39 1; #X connect 42 0 39 1; #X connect 43 0 41 0; #X connect 43 1 37 0; #X connect 43 1 38 0; #X connect 44 0 39 0; #X connect 47 0 35 0; #X connect 50 0 49 0; #X connect 51 0 50 0; #X connect 52 0 50 0; #X connect 53 0 55 0; #X connect 54 0 34 0; #X connect 55 0 56 0; #X connect 55 1 54 0; #X connect 55 2 5 0; #X connect 57 0 58 0; #X connect 58 0 51 0; #X connect 58 1 52 0; #X coords 0 -1 1 30 158 32 1 0 0;