Local Time Script
From Blue Mars Developer Guidebook
Example script using System/GetLocalOSTime and ShowTime
MyTime = {
days = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"},
}
-- call this from a trigger or whatever
function MyTime:Start()
ARDebug(3)
ARDebugMessage("MyTime active!")
self:Activate(1) -- make sure OnUpdate is called
ShowTime() -- prints local os time in the log
end
function MyTime:OnUpdate(deltaTime)
ARPrintReset() -- reset ARPrint cursor
local timetable = System.GetLocalOSTime()
if timetable.isdst then
ARPrint("Daylight Savings Time")
else
ARPrint("Standard Time")
end
ARPrint("Date: "..(timetable.mon+1).."/"..timetable.mday.."/"..(timetable.year+1900))
ARPrint("Day of the week: "..self.days[timetable.wday+1])
ARPrint("Time: "..timetable.hour..":"..timetable.min..":"..timetable.sec)
end
