kobo: detect non-epoch timestamp using current second

pull/2064/head
Qingping Hou 8 years ago
parent 589d2e757e
commit 38a1758889

@ -141,13 +141,15 @@ end
local probeEvEpochTime local probeEvEpochTime
-- this function will update itself after the first touch event -- this function will update itself after the first touch event
probeEvEpochTime = function(self, ev) probeEvEpochTime = function(self, ev)
-- this check should work if the device has uptime less than 10 years local now = TimeVal:now()
if ev.time.sec <= 315569260 then -- 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 -- time is seconds since boot, force it to epoch
probeEvEpochTime = function(_, _ev) probeEvEpochTime = function(_, _ev)
_ev.time = TimeVal:now() _ev.time = TimeVal:now()
end end
probeEvEpochTime(nil, ev) ev.time = now
else else
-- time is already epoch time, no need to do anything -- time is already epoch time, no need to do anything
probeEvEpochTime = function(_, _) end probeEvEpochTime = function(_, _) end

Loading…
Cancel
Save