--[[ Exit the US countdown clock --]] module(...,package.seeall) require("xap") require("xap.bsc") info={ version="1.0", description="Leaving the US" } leaving=os.time{hour=17,year=2012,month=6,day=7} function update(t,e) local sec = os.difftime(leaving, os.time()) local days = math.floor(sec/86400) sec = sec - days * 86400 local hours = math.floor(sec/3600) e:setText(string.format("%d days %d hours", days, hours)) e:sendEvent() end function init() local e = bsc.Endpoint{source="dbzoo.livebox.Plugboard:US", direction=bsc.INPUT, type=bsc.STREAM} update(nil, e) xap.Timer(update, 3600, e):start() end