Chronon: an experiment with os.time() and os.date()

The code below illustrates and explains Issue No. 217 identified in the Issue Tracker:


--
-- Chronon
--

function setup()
    print("os.time() returns the number of seconds since "..
        "00:00:00 1 January 1970.")
    print("Lua's number type in Codea version 1.4.6 can record current times only "..
        "to within an accuracy of 128 seconds.")
    timeCheck()
    print("Touch the Viewer for an update. Up to two minutes and "..
        "eight seconds must pass before the reported time and "..
        "date changes.")
end

local trialCount = 0
function timeCheck()
    local timeValue = os.time()
    local timeValueString = string.format("%.1f", timeValue)
    local dateString = os.date("%c", timeValue)
    trialCount = trialCount + 1
    print(trialCount..": "..timeValueString.." seconds is "..dateString)
end

function draw() background(0) end

function touched(touch)
    if touch.state == BEGAN then timeCheck() end
end

It would be nice to have an option to use 64 bit precision for math when speed isn’t needed but precision is.