-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================

local function updateTimer()
	local minutes = math.floor(timer.Value/60)
	local seconds = math.floor(timer.Value%60)
	
	if seconds >= 10 then
		textLabel.Text = tostring(minutes)..":"..tostring(seconds)
	else
		textLabel.Text = tostring(minutes)..":0"..tostring(seconds)
	end
	
	local raceStatus = RaceManager:GetRaceStatus()
	if (raceStatus == RaceManager.Status.Countdown and TopBar.Enabled) then
		if seconds == 0 then
			CountdownEndBeep:Play()
		else
			CountdownBeep:Play()
		end
	end
end -- updateTimer()