As a result of the Year 2038 problem(https://en.wikipedia.org/wiki/Year_2038_problem), we get nil after calling os.time({year=2039, month=1, day=1, hour=0, sec=1}) on a 32bit machine.How to make it compatible in the lua layer,and get result like running on a 64bit machine? Is it prosible to write a function like the following? Otherwise, how to achieve it?
local function time32Compatibility(timeTable)
local kMaxYearIn32Bit = 2037;
if timeTable and timeTable.year and timeTable.year >= kMaxYearIn32Bit then
local originalTable = clone(timeTable);
timeTable.year = kMaxYearIn32Bit;
local deltaTime = calculateDeltaTime(timeTable,originalTable)
return os.time(timeTable) + kMaxYearIn32Bit*;
else
return os.time(timeTable);
end
end
How to write calculateDeltaTime()?