Time Clock

Someone recently mentioned wanting a clock in GP. I found a quick and easy clock solution in the App Store. Windows users have a variety of options as well. Clocky($1.99) is sizable, can float on top, and can be placed anywhere on the screen.

26%20AM

20%20AM

1 Like

That’s not bad.

By the way, does anybody know the correct usage of:

Print(FormatTime(ClockTime(), “HH:mm:ss”))

1 Like

We are using the C++ strftime format strings

See http://www.cplusplus.com/reference/ctime/strftime/ for examples.

1 Like

Thank you, is working fine - as always!

Yes! Clocky looks brilliant; sold!

The only downside to Clocky is that it won’t stay on top if GP is in full screen mode. I would prefer to have the time displayed within GP. If you write a script, pianopaul, would you mind sharing it?

I am not Pianopaul, but i used his code-snippet to got a working script.

2019-03-08%2018_06_26-Window

Just make a text label and name it “lbl_time” (without the quotation marks), then use the following code:

var lbl_time : widget

    // Called by timer ticking
    On TimerTick(ns : double)
        lbl_time.SetWidgetLabel (FormatTime(ClockTime(), "%H:%M:%S"))
    End

@dhj: May this callback lead to timing problems, because it’s called several times per second?

1 Like

Good question…depends totally on what you do…this is real-time stuff… no guarantees…audio has priority but (currently) callbacks cannot be interrupted so if a lot happens in a callback, you could get grief.

Thanks. I’ll try this script and see if it affects performance.

I tried the script. I copied it to all the backspaces in my setlist. It works until I return to the rackspace or song. The time stops and won’t start again unless I open the script editor and compile again. I can’t tell yet if it is affecting overall performance of GP. Thanks for your help.

It seems that the timer routines have to be initialized on activation…
This code should do:

var lbl_time : widget

// Called by timer ticking
On TimerTick(ns : double)
    lbl_time.SetWidgetLabel (FormatTime(ClockTime(), "%H:%M:%S"))
End

// Called when rackspace is activated
On Activate
    SetTimersRunning(true)
End
1 Like

Thanks, Erik. It’s working. I haven’t noticed any performance issues. At some point, if and when global scripting becomes a reality, one would only have to write it once.

Hey thanks a lot for that @schamass!! Will give that a try.

1 Like

Thanks for all the help from schamass on on the clock script. I did a little inquiry online and altered the script slightly to display 12-hour time format.
var lbl_time : widget

// Called by timer ticking
On TimerTick(ns : double)
lbl_time.SetWidgetLabel (FormatTime(ClockTime(), “%r”))
End

// Called when rackspace is activated

On Activate
SetTimersRunning(true)
End
16%20PM

3 Likes

Thank you for this tip. I was creating a script that used On TimerTick and couldn’t figure out why it stopped working once I came back to the rackspace. Using SetTimersRunning(true) fixed it.

1 Like

You could update the label every n-th time which will cut down on intensity.

1 Like