Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting number of seconds to Hours:Minutes:Seconds
#1
I have an Elk M1 counter which contains the number of seconds until a timer triggers. I would like to display this counter value, but in a user friendly way such as Hours:Minutes:Seconds. Is there an easy way of doing this (and the opposite, converting Hours:Minutes:Seconds to seconds)? If someone can point me in the right direction (e.g., can it be done in the Action interface, or does it require CML), that would be a great start. Thanks!
Reply
#2
Use a Field Time widget.
Dean Roddey
Explorans limites defectum
Reply
#3
Dean, correct me if I'm wrong....but the only format character that can be used with something that holds an "elapsed" time (or countdown like this) is the %x, which gets you the elapsed time, but in a specific format. Anything over 24 hours worth of elapsed counter with a normal %h will get you something messed up, correct?
Reply
#4
Dean Roddey Wrote:Use a Field Time widget.
The Field Time Text widget only shows $LoadTime as a field. Am I doing something wrong?
Reply
#5
Oh, the counters aren't time fields, so they won't be available, sorry. They wouldn't always represent times. Hmmm.... So there's not going to be too easy a way to deal with this, at least in any way that's displayable as it changes.

About the only thing I can think of is to set up a triggered event that gets kicked off on any change of the counter you care about, and have it turn around and multiply the value and set it into a Time field in a variable driver instance. A lot of work and overhead just to get that value displayed.

Another would be to set up an event in the template that contains the display widget. Make the widget a static text widget, and have the template event (which will be triggered on any change of the counter) convert the text and set it on the static text widget.

The latter is more efficient since it's only happening when you need it to happen and not all the time. But the triggers are still going to be getting spit out on every single change of the field, so that's a network wide occurrance, which is sub-optimal.

So there's not really any really good answer.
Dean Roddey
Explorans limites defectum
Reply
#6
beelzerob Wrote:Dean, correct me if I'm wrong....but the only format character that can be used with something that holds an "elapsed" time (or countdown like this) is the %x, which gets you the elapsed time, but in a specific format. Anything over 24 hours worth of elapsed counter with a normal %h will get you something messed up, correct?

There were new tokens added for V3 which I think will handle this sort of scenario, if you want to show a count of minutes or seconds and not an elapsed time type thing.
Dean Roddey
Explorans limites defectum
Reply
#7
Well, the main issue I had was an elapsed time passing 24 hours, because then you couldn't use the days token, as it would always start at 1 instead of 0 days.
Reply
#8
There are now tokens for elapsed units.
Dean Roddey
Explorans limites defectum
Reply
#9
Dean Roddey Wrote:There are now tokens for elapsed units.

Eeeeeeeeeeeeeeeeeeeeeexcellent. :cool
Reply
#10
So I started working on this, and the formula is pretty straight forward. However, I am used to using the mod operator to calculate the remaining seconds, but can't find such operator in CQC. Am I looking in the wrong place, or is it not possible to do this?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Week Number RTV znelbok 1 109 10-22-2019, 06:58 PM
Last Post: Dean Roddey
  Generate Random Number in a Trigger batwater 1 946 12-10-2017, 12:43 PM
Last Post: Dean Roddey
  I have an event that I want to happen 5 hours after sunset. ghurty 8 3,776 03-24-2017, 08:40 AM
Last Post: Dean Roddey
  Converting Int4 to String zra 11 2,748 04-03-2015, 02:19 PM
Last Post: zra
  Correspond image to number? jkmonroe 1 1,300 02-07-2015, 08:10 PM
Last Post: Dean Roddey
  vBulletin getting excess number of access violations Mark Stega 3 1,736 06-20-2014, 08:49 AM
Last Post: Dean Roddey
  Displaying slot number diy8888 18 4,020 05-19-2014, 05:22 AM
Last Post: Dean Roddey
  Not a Valid Zone Number for Blaster Jnetto 21 4,636 12-24-2013, 03:51 PM
Last Post: Dean Roddey
  Every 10 seconds exactly I get ???? on every field in my IV Deephaven 13 2,238 07-16-2013, 01:24 PM
Last Post: Deephaven
  Conver text to number? jpants 3 1,284 03-16-2010, 10:47 AM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)