[Q] truncating or rounding time numbers



  • Anyone got a method for using time numbers for anything else than visual feedback?

    When connected to anything else an actor with a _time_ output gives you time in seconds with many decimals rolled into one. so 12.3456 becomes 123456.
    I need to either truncate the decimals or round them up or down. I have had no luck with the text formatter so far.
    An example of this being a limitation is the "timer" actor who's output can not be connected to a comparator. A rounded second will probably do for making a timed cue trigger.
    any ideas?
    thank you
    fubbi

  • Tech Staff

    The timer actor can be connected to a comparator. It will however convert from seconds to milliseconds for numerical output (as you mentioned, see note below).
    If all you want is the ability to enter time as Hours Minutes Seconds, I would suggest making user actors for this conversion on both ends (as input and as output for reading/display).
    As far as using the timer as a method of creating a cues system. It will work very well (I just finished a project that had many scenes that all simply used a millisecond timer to send a secondary 'engine' commands synced to audio backing tracks)
    You just need to be aware of time lost between cycles.. if your system is running slowly due to video processing or what ever, a few milliseconds will pass between code cycles, therefore you need to check for your cue plus any lost period of time (a buffer).
    You can even try to calculate the per cycle time and use this as a unit for creating your time buffer (use more than one unit).

    PS: your time example shows 4 decimal values, I can only find example of time actors giving three (millisecond units). If any are giving more decimal values, this will need to be dealt with differently.



  • I have attached a simple user actor that takes a time in milliseconds and outputs as hours, minutes, seconds.  Perhaps this could be a useful start for you.

    Craig

    387444-timer.iua



  • Just a quick comment: if you want seconds, just divide the number by 1000.

    Best,
    M


  • Tech Staff

    Hi Fubbi

    Maybe my TimerTool is helpful, you find it in the first post:
    http://troikatronix.com/troikatronixforum/discussion/123/timertool-v1.2.6-update#Item_5

    Best
    Michel



  • Thank you everybody!!


Log in to reply
 

Looks like your connection to TroikaTronix Community Forum was lost, please wait while we try to reconnect.