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 automatically after script is loaded and after compile
Initialization
    SetTimersRunning(true)    
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 automatically after script is loaded and after compile
Initialization
    SetTimersRunning(true)    
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

I recently moved from an Intel based mac to an M2 based mac. When I was setting up the new computer I installed the newest version of GP. My old laptop is still running the previous version.

For the life of me I can not get this script to run on the new system. I have checked and double-checked a hundred times that it is set up exactly as it was before.

Has anyone that uses this script has problems with it after migrating to an M2mac from an Intel or after installing the newest version of GP?

I would love to get this script running again.

If you know of a different method of accomplishing the same thing, I am all ears, too.

I don’t suppose you’d care to elaborate on I can not get this script to run for us!

Do you get a compilation error? Is there an error message in the script log? Does the system crash?

Right now, your question is like going to the doctor, telling him you’re sick but providing absolutely no useful information to help diagnosis the problem :slight_smile:

2 Likes

Just tried it and everything worked flawlessly, using the very latest version of GP.
The OS of your computer doesn’t matter at all here!

  • what exactly is the issue you are facing?
    (compile error? freeze? crash? no time reading? cat hungry? :innocent: :wink:)
  • have you placed a label on the panel with the script handle “lbl_time” ?
  • have you copied the whole code?
  • have you pasted it into the “Current rackspace script editor”?
  • have you pressed “Compile!” after pasting the code into the editor?

Maybe you should create at least a second rackspace (can be empty) to have something to change to and then back (to have an “activation” for the script)…

Better use the following code where i added an initialization block, so that the time will start to run immediately after compiling, if there is another rackspace or not.
(I will also edit the older posting and add the code snippet)

var lbl_time : widget

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

// Called automatically after script is loaded and after compile
Initialization
    SetTimersRunning(true)    
End

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

dhj and Shamass,

Thank you both for replying so quickly. You are right… I guess I did leave out a considerable amount of detail that would have helped pinpoint my problem. That’s what I get for making spur of the moment posts while on a break at work. :smiley:

dhj, The script compiles successfully. No crashes or anything like that. The text widget just shows the text “lbl_time” and not the time.

Shamass, in your post you mentioned copying all the code into the “Current rackspace script editor”. This leads me to believe I may have managed to complete a double faux pas. Not giving enough detail and posting to the wrong thread… In my gig file on my old computer the script is in the Global Rackspace Script Editor. I just checked, and there is indeed a different thread for Time Clock in Global Rackspace.

I appreciate you both responding so quickly. I think it best that I reformulate my question with proper details and ask again over on the correct thread.

1 Like