• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Lua] Time result cannot be represented in this installation

Level 24
Joined
Jun 26, 2020
Messages
1,853
Hello, in my save load system I included save the date when the save was made, to the players can keep track of them but for some reason in this line to show the date:
Lua:
BlzFrameSetText(TooltipDate, os.date("\x25c", os.time(data.date)))
Sometimes happens this error:
1693434861720.png

To let you know, the value data.date is a table that stores the fields: year, month (1–12), day (1–31), hour (0–23), min (0–59), sec (0–61, due to leap seconds), wday (weekday, 1–7, Sunday is 1), yday (day of the year, 1–366), and isdst (daylight saving flag, a boolean).
I can't check what is happening, because as I said it only happen sometimes so is hard to me replicate it and debuging it, do you know what is happening? I tried to google it but I hardly found something.
 
Level 20
Joined
Jul 10, 2009
Messages
479
I have never seen this error before, but it sounds like a specific combination of time data can not be represented in string format. You should try to find an example combination leading to the bug.

I'd go with Debug.log(table.tostring(data.date)) in PressSaveOrLoad line 107 and wait until the error occurs again. It will show the erroneous configuration on screen.
 
Level 19
Joined
Jan 3, 2022
Messages
320
If you encounter an error when getting the time (calling os.time(xxx)) [ time result cannot be represented in this installation]

The reason is that the incoming xxx does not specify the year, month and day or the year, month and day, and the result is a date earlier than January 1, 1970. The solution is to specify a year, month and day that is clearly later than this date, or write 2 for the day, do not use 1 .
os.time Lua 5.3 — форум QUIK suggests that with Lua 5.3 a negative timestamp will not be returned as nil but throw an error. How would it happen for 1970-01-01 00:00? Due to time zone offsets

smb2 os.date exception on Windows 10 · Issue #1303 · nmap/nmap max values

Nmap 7.90 broken script scan on Windows in UTC+n time zones · Issue #2136 · nmap/nmap Windows only and only for UTC+n
C:
if (*s == '!') {  /* UTC? */
    stm = l_gmtime(&t, &tmr);
    s++;  /* skip '!' */
  }
  else
    stm = l_localtime(&t, &tmr);
  if (stm == NULL)  /* invalid date? */
    return luaL_error(L,
                 "time result cannot be represented in this installation");

Solution: always use os.date with pcall (2038 year problem), especially in a 32-bit installation like Warcraft 3
 
Top