[feat] Replace TimeVal (RIP) with time, fixed point time seconds (#8999)

This commit is contained in:
zwim
2022-05-05 21:00:22 +02:00
committed by GitHub
parent 54ead5fc88
commit 9b9cfe29a4
44 changed files with 1009 additions and 497 deletions

View File

@@ -56,11 +56,11 @@ local ReaderWikipedia = require("apps/reader/modules/readerwikipedia")
local ReaderZooming = require("apps/reader/modules/readerzooming")
local Screenshoter = require("ui/widget/screenshoter")
local SettingsMigration = require("ui/data/settings_migration")
local TimeVal = require("ui/timeval")
local UIManager = require("ui/uimanager")
local ffiUtil = require("ffi/util")
local lfs = require("libs/libkoreader-lfs")
local logger = require("logger")
local time = require("ui/time")
local util = require("util")
local _ = require("gettext")
local Screen = require("device").screen
@@ -290,19 +290,19 @@ function ReaderUI:init()
end
-- make sure we render document first before calling any callback
self:registerPostInitCallback(function()
local start_tv = TimeVal:now()
local start_time = time.now()
if not self.document:loadDocument() then
self:dealWithLoadDocumentFailure()
end
logger.dbg(string.format(" loading took %.3f seconds", TimeVal:getDuration(start_tv)))
logger.dbg(string.format(" loading took %.3f seconds", time.to_s(time.since(start_time))))
-- used to read additional settings after the document has been
-- loaded (but not rendered yet)
self:handleEvent(Event:new("PreRenderDocument", self.doc_settings))
start_tv = TimeVal:now()
start_time = time.now()
self.document:render()
logger.dbg(string.format(" rendering took %.3f seconds", TimeVal:getDuration(start_tv)))
logger.dbg(string.format(" rendering took %.3f seconds", time.to_s(time.since(start_time))))
-- Uncomment to output the built DOM (for debugging)
-- logger.dbg(self.document:getHTMLFromXPointer(".0", 0x6830))