Examples

Normal Clock

Time Script
{{ Clock | gaz.FormatDateTime "Seconds" false }}

Clock with flashing separator

The current clock is captured in the variable now. Then we compare the datetime's Second property and see if it is even. Depending on the output of this comparison the clock is formatted with different formatters. Also also not showoing seconds.

Time Script
{{
# capture current time in variable now
now = date.Now

# depending on second, either with or without :
if now.Second  %2 == 0
    nowString = now | Format "HH:mm"
else
    nowString = now | Format "HH mm"
end

# variable to switch between output on the hour:min or min:sec digits 
outputAsHours = false
if (outputAsHours)
    # append with blanks for :00.000
    nowString = nowString + "       "
else 
    # prepend with HH: and append with .000
        nowString = "   " + nowString + "    "
end
nowString
}}

Show clock before start, runtime after start and gap time after winner finish

The following script allows to show the current clock before the start of the race, a runtime during the race and a gap time to winner as soon as the first athlete finishes.

This can be achieved by having the race start TOD and the winner TOD available in a RR12 list. The actual content of these values depend on your event file setup.

This list is then pulled via RRExchange globals feature periodically into the software.

The pulled global list entries are available as variables in each script then. They are identified by .First., e.g. GlobalsName.First.Starttime for a RR12 field named Starttime in a globals list GlobalsName.

{{
# Get current TOD and convert to seconds
now = timespan.Now | ToSeconds

# Fetch race start time and winner time from Globals List and convert to seconds (this way RR12 field can be seconds or HH:mm:ss string
raceStartedAt = StartAndWinnerList.First.Starttime | ToSeconds
winnerFinishedAt = StartAndWinnerList.First.Winnertime  | ToSeconds

# Determine race states
isRaceStarted = raceStartedAt > 0

# Determine output based on is race started or not
if isRaceStarted 
    # Race is started, check for winner time is present    
    isWinnerFinished = winnerFinishedAt > 0

    if (isWinnerFinished)
        # Winnner is finished, show gap time

        # Calculate gap time
        timeSinceWinner = now - winnerFinishedAt
        timeSinceWinner | gaz.Format "Seconds" false

    else 
        # No winner present, show running time


        # Calculate runtime
        timeSinceStart = now - raceStartedAt
    timeSinceStart | gaz.Format "Seconds" false

    end

else 
    # Before Start

   ""


end

}}

Last updated