Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Displaying countdown timer in clock format (not hex)
Dean answered this question via email. I thought I would post the Q&A for future searchers.
Hi Dean,

I’ve searched the forum and found scary stuff like this:

I have a timer driver with moniker ├ó┬Ç┬£Timer├ó┬Ç┬Ø

I have a countdown timer cdtimer 1 that I set to 3 minutes or 20 minutes depending on which button is pushed. E.g.,
P2=ResetCD 1 Minutes 3

Here is what I would like to do:

I want to display the time remaining in hh:mmConfuseds and see it count down in an interface. The timer value will never exceed 24 hours. I want to see the seconds tick by.

Dean's Answer

Actually, it’s really easy to do now. What you saw there in that thread was long ago. A lot of stuff has been added since then to help with that sort of stuff.

These days you can use a Time Text widget, a field based one in this case. It has a formatting scheme where you can just tell it what components of the associated time field’s value to display. You just set up a string with replacement tokens. The text displayed will be built up by replacing those tokens with the values of the time that they represent. The tokens are defined in the Time class:

But what you want is a standard format, and there’s a single token that does that all in one shot, %(z):
'z' - Calculates the elapsed hours, minutes and seconds, and formats them out in two digit, leading zero form with local specific separators, e.g. 03:15:08.
So just create a field based Time Text widget, pop up the widget’s configuration, select the countdown timer field you want to display, and then on the tab where you set the format, just enter %(z) as the pattern. That should get you want you want. To make it ‘clock-like’ just set the font to a non-proportional font, so that each digit takes up the same width. That way it won’t move around as the digits change.

If you would like it not to display leading hour zeros, use capital Z, e.g. %(Z). That will display the hours if non-zero, but leave them out if zero. Though it does also mean that, when it hits an hour and moves below it, it’ll suddenly drop the hours and just show the minutes/seconds, whereas %(z) will display the hours always, even if zero but it’s consistently going to be 8 characters. So whichever you find works visually the best for you.

Dean Roddey

Messages In This Thread
Displaying countdown timer in clock format (not hex) - by ControlFreak - 04-10-2013, 08:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  event and subsequent countdown timer question dogman 9 5,052 05-03-2018, 06:36 PM
Last Post: dogman
  Countdown Timer with Elk Zone Stipe 3 2,280 09-28-2015, 02:59 PM
Last Post: Dean Roddey
  Best audio format??? rtarver 5 3,126 12-26-2012, 02:10 PM
Last Post: Dean Roddey
  How to Set your ELK Clock rbroders 5 3,957 06-14-2012, 09:53 PM
Last Post: rbroders
  CD Timer Query brathnach 16 5,137 06-05-2010, 08:40 AM
Last Post: Dean Roddey
  Displaying images martinmcc 1 1,648 07-23-2009, 11:06 AM
Last Post: Dean Roddey
  Error displaying cameras Trioxide 1 1,570 06-24-2009, 01:42 PM
Last Post: Trioxide
  Timer eded9698 15 5,249 05-16-2009, 03:39 PM
Last Post: Dean Roddey
  Displaying album artwork Trioxide 9 3,107 03-04-2009, 11:49 AM
Last Post: Dean Roddey
  Problem with Displaying html Files in htmlroot kblagron 7 3,133 09-12-2008, 03:23 PM
Last Post: Dean Roddey

Forum Jump:

Users browsing this thread: 1 Guest(s)