Merge pull request #2064 from koreader/houqp-master

kobo: detect non-epoch timestamp using current second
pull/2076/head
Hzj_jie 8 years ago
commit c83036c1bc

@ -141,13 +141,15 @@ end
local probeEvEpochTime
-- this function will update itself after the first touch event
probeEvEpochTime = function(self, ev)
-- this check should work if the device has uptime less than 10 years
if ev.time.sec <= 315569260 then
local now = TimeVal:now()
-- This check should work as long as main UI loop is not blocked for more
-- than 10 minute before handling the first touch event.
if ev.time.sec <= now.sec - 600 then
-- time is seconds since boot, force it to epoch
probeEvEpochTime = function(_, _ev)
_ev.time = TimeVal:now()
end
probeEvEpochTime(nil, ev)
ev.time = now
else
-- time is already epoch time, no need to do anything
probeEvEpochTime = function(_, _) end

@ -16,10 +16,10 @@ function WidgetContainer:init()
self:initDimen()
else
if not self.dimen.w then
self.dimen.w = self[1].getSize().w
self.dimen.w = self[1]:getSize().w
end
if not self.dimen.h then
self.dimen.h = self[1].getSize().h
self.dimen.h = self[1]:getSize().h
end
end
end

Loading…
Cancel
Save