Browse Source

BigClockExtra: Added leading zeros to seconds display. closes #3

master
Ludwig Frühschütz 4 years ago
parent
commit
110bb486d8
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      BigClockWithExtras/BigClockExtra.lua

+ 8
- 1
BigClockWithExtras/BigClockExtra.lua View File

@ -143,6 +143,7 @@ function drawGui()
local val
local timeRaw
local timeDisplay
local timeDisplaySeconds
local markerId
local regionId
local isRegion
@ -167,7 +168,13 @@ function drawGui()
end
if retval > 0 then timeRaw = timeRaw - markerRegionPos end
timeDisplay = math.floor(timeRaw/60) .. ":" .. math.floor((timeRaw%60)*1000)/1000
-- construct display string, with leading zeros if neccessary (e.g. 27:08.321)
timeDisplaySeconds = math.floor((timeRaw%60)*1000)/1000
timeDisplay = math.floor(timeRaw/60) .. ":"
if timeDisplaySeconds < 10 then
timeDisplay = timeDisplay .. "0"
end
timeDisplay = timeDisplay .. timeDisplaySeconds
gfx.clear = 3355443 -- background is dark grey


Loading…
Cancel
Save