Avoids precision issues on servers with long GETTIME_UPTIME.
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
//idea: tZork
//darkplaces implementation: tZork, divVerent
//constant definitions:
-float GETTIME_FRAMESTART = 0; // time of start of frame
+float GETTIME_FRAMESTART = 0; // time of start of frame relative to an arbitrary point in time (time of worldspawn)
float GETTIME_REALTIME = 1; // current time (may be OS specific)
-float GETTIME_HIRES = 2; // like REALTIME, but may reset between QC invocations and thus can be higher precision
-float GETTIME_UPTIME = 3; // time since start of the engine
+float GETTIME_HIRES = 2; // like REALTIME, but relative to time at start of frame (thus can be higher precision)
+float GETTIME_UPTIME = 3; // time of start of frame relative to start of the engine
//builtin definitions:
float(float tmr) gettime = #519;
//description:
//idea: tZork
//darkplaces implementation: tZork, divVerent
//constant definitions:
-float GETTIME_FRAMESTART = 0; // time of start of frame relative to an arbitrary point in time
+float GETTIME_FRAMESTART = 0; // time of start of frame relative to an arbitrary point in time (time of worldspawn)
float GETTIME_REALTIME = 1; // current absolute time (OS specific)
-float GETTIME_HIRES = 2; // like REALTIME, but may reset between QC invocations and thus can be higher precision
-float GETTIME_UPTIME = 3; // time of start of frame since start of the engine
+float GETTIME_HIRES = 2; // like REALTIME, but relative to time at start of frame (thus can be higher precision)
+float GETTIME_UPTIME = 3; // time of start of frame relative to start of the engine
//builtin definitions:
float(float tmr) gettime = #519;
//description:
switch(timer_index)
{
case 0: // GETTIME_FRAMESTART
- PRVM_G_FLOAT(OFS_RETURN) = host.realtime;
+ PRVM_G_FLOAT(OFS_RETURN) = host.realtime - prog->starttime;
break;
case 1: // GETTIME_REALTIME
PRVM_G_FLOAT(OFS_RETURN) = Sys_DirtyTime();