Countdown to planned starttime and then runtime (Globals)


Last updated


Last updated
{{
now = Clock.TimeOfDay.TotalSeconds
plannedStarttime = GlobalsName.First.PlannedStarttime | ToSeconds
actualStarttime = GlobalsName.First.Starttime | ToSeconds
# Check for if an actual start time is set
if (actualStarttime == 0)
# Countdown to planned start time
# Calculate duration until start
durationUntilStart = plannedStarttime - now
# If duration has elapsed but no actual starttime is present, stay at 0
if (durationUntilStart < 0)
durationUntilStart = 0
end
# Format countdown time
displayText = durationUntilStart | FormatRaceResult "HH:Mm:ss"
# Output countdown in red
colorString = "Red"
else
# Runtime after actual start time
# Calculate runtime since actual start
elapsedSinceStart = now - actualStarttime
# Format runtime
displayText = elapsedSinceStart | FormatRaceResult "HH:Mm:ss"
# Output runtime in green
colorString = "Green"
end
(mled.Color colorString) + (TrimPad displayText 8 "Right")
}}