Forum > Linux
Range Check error - works fine after reboot
TheMouseAUS:
I have an application I made which runs 24/7 after a few weeks i get the error message 'Rage Check Error'. I close the app and start it again but the error comes up before the form is even drawn on the screen. A reboot of the PC and with works perfectly fine again. What is the best way of diagnosing/debugging this issue?
The PC is running Fedora 38 Plasma - QT5
Complied on Lazarus 2.2.6/ FPC 3.2.2
Fedora 38 X64
QT5
Bart:
Build with -Cr (range checks enabled) and -gl, sou you get a linenumber information in the stacktrace.
Bart
paweld:
According to what you write, it seems to me that somewhere in the code you use GetTickCount - that is, the problem starts after 24 days and 20.5 49 days and 17 hours (corrected after Thaddy's post). Restarting the computer helps because the counter then starts from 0.
Replace GetTickCount with GetTickCount64 and if you are writing the result to a variable then change its type to Int64 QWord - this should solve the problem.
Thaddy:
That is indeed the correct answer, Pawel, except it wraps every 49,7 days since its value is unsigned. And this has been a very old problem and every programmer could have known this. The issue is not even related to Freepascal but initially related to the Windows API.
It is also documented in the FPC manuals.
GetTickCount returns a cardinal
GetTickCount64 returns a Qword
Never use a signed integer type for either version.
paweld:
--- Quote from: Thaddy ---except it wraps every 49,7 days since its value is unsigned.
--- End quote ---
My bad. Corrected
Navigation
[0] Message Index
[#] Next page