Graphics

 View Only
  • 1.  Subtracting time in visual logic or script

    Posted 07-18-2022 15:20
    I am primarily a designer and only occasionally dig into visual logic or scripting.  I need to subtract a time (mm:ss) we receive from a Datalinq from a manually inputted time and have a field that has the difference in the same mm:ss format. If that makes sense any help would be greatly appreciated.

    ------------------------------
    Jarod Valentin
    ------------------------------


  • 2.  RE: Subtracting time in visual logic or script

    Posted 07-19-2022 11:45
    Hey Jarod,
    I imagine you're going to be looking for something like this:

    The Time Delta block under DateTime will output data based on two Date Time data points entering into it, which you'll need to use Encode Date Time blocks to turn the data you need into DateTime types by declaring what parts of your text are (hours/minutes/seconds/etc).

    Hopefully that sets you in the right direction.

    ------------------------------
    Mike DeMarco
    Video Production Engineer
    Las Vegas United States
    ------------------------------



  • 3.  RE: Subtracting time in visual logic or script

    Posted 07-19-2022 13:25
    Cool, thank you!  this got me in the right place for what I need to do.

    ------------------------------
    Jarod Valentin
    ------------------------------



  • 4.  RE: Subtracting time in visual logic or script

    MalThePal
    Posted 07-20-2022 19:10

    Here's the way I did it. This allows the operator to offset the timer via a dashboard input. We would go live at the top of the hour and there was a countdown timer to the beginning of each live event. Many ways to do it. 


    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 5.  RE: Subtracting time in visual logic or script

    Posted 07-21-2022 10:05
    Hey Mal,
    Curious about the second Encoder for the seconds; is there a specific reason for it that I might be missing?

    ------------------------------
    Mike DeMarco
    Video Production Engineer
    Las Vegas United States
    ------------------------------



  • 6.  RE: Subtracting time in visual logic or script

    MalThePal
    Posted 07-21-2022 10:14
    It's been a while since I designed this one. The offset math only affects minutes. So the second encoder for the seconds basically injects seconds back in. On my dashboard the display is 00:00:00 so it is clear for the operator. But the hours are stripped away, and the seconds aren't even in play. I'll take a second look at it. (just looked) I remember why I did it the way I did. I didn't like the appearance of the clock when online. I broke the clock out into its elements and reassembled them using concatenate. I used a time format that was a blank leading zero in the minutes. So, when it counted down to 9:59 the timer was offset slightly to the right. I didn't like that so I recombined the elements so I could treat it as a complete text block subject to all centering and squeezing/scaling as a whole. (looked again). I have no idea why I double encoded the seconds. I'll go back in and break that link and see what happens.

    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 7.  RE: Subtracting time in visual logic or script

    Posted 07-21-2022 10:33
    Ha, 10-4. Thanks for the reply about it.

    Also, noticed that you're a Freelancer (and very active on the Boards!); any chance I might be able to reach out and pick your brain a little about that? Absolutely no worries, if not!

    ------------------------------
    Mike DeMarco
    Video Production Engineer
    Las Vegas United States
    ------------------------------



  • 8.  RE: Subtracting time in visual logic or script

    MalThePal
    Posted 07-21-2022 10:37
    Pick away.There isn't much left up there in my skull.

    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 9.  RE: Subtracting time in visual logic or script

    Posted 08-16-2022 07:42
    Hi Jarod
    Try this script. Set it in the text object to which the DataLink is connected. "Delay" is a text object for entering the time difference, "outtime" is a text object with final results.
    Dim delaytxt, outtxt As xpTextObject
    scene.GetObjectByName("delay", delaytxt)
    scene.GetObjectByName("outtime", outtxt)
    Dim intime As System.DateTime
    Date.TryParse(Text, intime)
    Dim delaytime As System.TimeSpan
    System.TimeSpan.TryParse(delaytxt.Text, delaytime)
    outtxt.Text = (intime + delaytime).ToString("mm:ss")


    ------------------------------
    ROMAN YAROSHENKO
    chief specialist
    RBC-TV
    Moscow Russian Federation
    ------------------------------