Open brightrim opened 1 year ago
I tested with "unix" which seems to be working fine, returning 1666721659.
"month" returns 16, as in Mas, even though it should return 2, as in Tanos.
Not sure if this breaks any scripts. Could potentially be urgent, as searches for world:getTime("day")
and world:getTime("month")
provide a lot of results, though most scripts appear to be using the still working world:getTime("unix")
for timestamp purposes.
So far the following scripts have shown up in the script error log as having been broken due to this: oldSlimeFeeding - seems to affect the text meant to be shown on a sign herbgathering - seems to affect the regrowth of plants as nextregrow itemData is not set as it can not figure out what season it is
Hrm, it isn't even 2038 yet...
A quick fix could be to move the time logics to a script function and see if the error can be reproduced. But of course, a proper fix of the server function is preferred.
Any hint on the root cause?
Root cause is likely in this line:
Using int here results in a variable overflow later on. Illarion time passes 3x as fast, so as Illarion time started in RL year 2000, we accumulated more than seconds of game life than can be stored in an int variable.
A solution would be to change the variable type to long or long long - given this does not break stuff further down the line
This needs to be reverted once the time function works properly again:
https://github.com/Illarion-eV/Illarion-Java/commit/1c13ef4b5c8e2531e931bf4cc05b20e1e37e1931
world:getTime() has suddenly started returning negative values
Discovered via this recent report.
I looked into it and found via a
log(world:getTime("day")
where it returned -4 (which matches the current login message of -4th of Mas) that it is the server function itself that is returning faulty values all of a sudden.