FORUMS: list search recent posts

# Clock/timer that updates every 2 seconds

FAQ   •   VIEW ALL
 Clock/timer that updates every 2 seconds on Aug 30, 2012 at 1:57:41 pm

Hi there Im not that great with expressionsâ€¦. and I need clock/timer that counts up in clock format but only updates every 2 seconds
e.g.

20 being hours / 56 minutes / 18 seconds
20:56:18
20:56:20
20:56:22
20:56:24

Also the time needs to be able to be set.
can any one help or at least point me in the right direction?

Thanks Matu

 Re: Clock/timer that updates every 2 secondson Aug 30, 2012 at 2:51:50 pm

Probably something close to this:

startHr = 20;
startMin = 56;
startSec = 18;

str = "" + n;
if (str.length < 2) str = "0" + str;
return str;
}
tStart = startHr*3600 + startMin*60 + startSec;
delta = Math.floor((time - inPoint)/2)*2;
t = tStart + delta;
h = Math.floor(t/3600)%24;
m = Math.floor((t%3600)/60)
s = t%60

Dan

 Re: Clock/timer that updates every 2 secondson Aug 30, 2012 at 3:18:23 pm

Cool that works but just one more thing is it possible to get it to update every frame? so it is more like a time stamp to that frame

thanks for the help

Mat

 Re: Clock/timer that updates every 2 secondson Aug 30, 2012 at 3:31:08 pm

I'm confused. Does that mean you want it to update more often than every two seconds? Even if it updates every second, it won't change every frame. Or are you asking for a different time format that includes frames?

Dan

 Re: Clock/timer that updates every 2 secondson Aug 30, 2012 at 3:33:05 pm

sorry for the confusion that is my fault

You did what I asked for but then I realised that I would need the time to jump by 2 seconds every for frame so it is more of a timestamp to every frame.

Mat

 Re: Clock/timer that updates every 2 secondson Aug 30, 2012 at 3:48:31 pm

Ah, OK -- like this then:

startHr = 20;
startMin = 56;
startSec = 18;

str = "" + n;
if (str.length < 2) str = "0" + str;
return str;
}
tStart = startHr*3600 + startMin*60 + startSec;
delta = Math.floor(timeToFrames(time - inPoint))*2;
t = tStart + delta;
h = Math.floor(t/3600)%24;
m = Math.floor((t%3600)/60)
s = t%60

Dan

 Re: Clock/timer that updates every 2 secondson Aug 30, 2012 at 3:53:10 pm

Ok that is now counting up in 2's for every frame but it seems to have lost the time formatting... is there something Im missing?

Mat

 Re: Clock/timer that updates every 2 secondson Aug 30, 2012 at 3:58:27 pm

30 frames in, I'm getting "20:57:18". What are you getting?

Dan

 Re: Clock/timer that updates every 2 secondson Aug 30, 2012 at 4:01:10 pm

Im getting just 720

edit "hold on.... my bad I missed some of the last bit of the code"

 Re: Clock/timer that updates every 2 secondson Aug 30, 2012 at 4:08:38 pm

Are you sure you pasted in the whole expression? I just tried it (copied and pasted from my post) and it works for me.

Dan