\r
function oletounixfloat(t:float):float;\r
function oletounix(t:tdatetime):integer;\r
-function unixtoole(i:integer):tdatetime;\r
+function unixtoole(i:float):tdatetime;\r
\r
{$ifdef win32}\r
function mmtimefloat:float;\r
result := trunc(oletounixfloat(t));\r
end;\r
\r
-function unixtoole(i:integer):tdatetime;\r
+function unixtoole(i:float):tdatetime;\r
begin\r
result := ((i)/86400)+daysdifference;\r
end;\r
f,g:float;\r
o:tosversioninfo;\r
isnt:boolean;\r
- is9x:boolean;\r
+{ is9x:boolean;}\r
begin\r
if (performancecountfreq = 0) then qpctimefloat;\r
ticks_freq_known := false;\r
o.dwOSVersionInfoSize := sizeof(o);\r
getversionex(o);\r
isnt := o.dwPlatformId = VER_PLATFORM_WIN32_NT;\r
- is9x := o.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;\r
+{ is9x := o.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;}\r
\r
ticks_freq2 := f;\r
mmtime_synchedqpc := false;\r
{\r
- NT 64 Hz\r
+ NT 5 64 Hz (RTC)\r
identify mode as: nt64\r
QPC rate: either 3579545 or TSC freq\r
QPC synched to gettickcount: no\r
duration between 2 ticks is constant: yes\r
gettickcount tick duration: 64 Hz\r
+\r
+ NT 6 64 Hz (HPET?)\r
+ identify mode as: nt64\r
+ QPC rate: TSC freq / 1000\r
+ QPC synched to gettickcount: no\r
+ duration between 2 ticks is constant: yes\r
+ gettickcount tick duration: ~15.6001007 ms, ~64.102 Hz\r
+\r
}\r
if (f >= 0.014) and (f <= 0.018) and isnt then begin\r
+ if (performancecountfreq = 3579545) or (performancecountfreq > 50000000) then begin\r
+ {typical XP}\r
+ ticks_freq := 1/64;\r
+ end else begin\r
+ {typical windows 7}\r
+ ticks_freq := 0.0156001007;\r
+ end;\r
ticks_freq_known := true;\r
- ticks_freq := 1/64;\r
mmtime_synchedqpc := false;\r
end;\r
\r
end;\r
\r
{9x}\r
- if (performancecountfreq = 1193182) and (g >= 0.050) and (g <= 0.060) then begin\r
+ if (performancecountfreq = 1193182) and (f >= 0.050) and (f <= 0.060) then begin\r
ticks_freq_known := true;\r
ticks_freq := 65536 / (colorburst / 3);\r
mmtime_synchedqpc := true;\r
maxretries=5;\r
margin=0.002;\r
var\r
- jump:float;\r
- mm,f,qpc,newdrift,f1,f2:float;\r
+{ jump:float;}\r
+ mm,f,qpc,newdrift:float;\r
qpcjumped:boolean;\r
- a,b,c:integer;\r
- retrycount:integer;\r
+ a,b:integer;\r
+{ retrycount:integer;}\r
begin\r
if not ticks_freq_known then measure_ticks_freq;\r
- retrycount := maxretries;\r
+{ retrycount := maxretries;}\r
\r
qpc := qpctimefloat;\r
mm := mmtimefloat;\r
mmtime_prev_lastsyncqpc := mmtime_lastsyncqpc;\r
\r
mm := mmtimefloat;\r
- dec(retrycount);\r
+ { dec(retrycount);}\r
settc;\r
result := qpctimefloat;\r
f := mmtimefloat;\r
{ mmtime_drift := mmtime_drift + mmtime_driftavg[a];}\r
end;\r
{ mmtime_drift := mmtime_drift / b;}\r
+ a := 5;\r
if (b = 1) then a := 5 else if (b = 2) then a := 15 else if (b = 3) then a := 30 else if (b = 4) then a := 60 else if (b = 5) then a := 120 else if (b >= 5) then a := 120;\r
mmtime_nextdriftcorrection := qpc + a;\r
if (b >= 2) then warmup_finished := true;\r
qpc := qpctimefloat;\r
\r
result := (qpc - mmtime_lastsyncqpc) * mmtime_drift + mmtime_lastsyncmm;\r
- f := (qpc - mmtime_prev_lastsyncqpc) * mmtime_prev_drift + mmtime_prev_lastsyncmm;\r
\r
+ {f := (qpc - mmtime_prev_lastsyncqpc) * mmtime_prev_drift + mmtime_prev_lastsyncmm;\r
jump := result-f;\r
- {writeln('jump ',formatfloat('0.000000',jump),' drift ',formatfloat('0.00000000',mmtime_drift),' duration ',formatfloat('0.000',(mmtime_lastsyncqpc-mmtime_prev_lastsyncqpc)),' ',formatfloat('0.00000000',jump/(mmtime_lastsyncqpc-mmtime_prev_lastsyncqpc)));}\r
+ writeln('jump ',formatfloat('0.000000',jump),' drift ',formatfloat('0.00000000',mmtime_drift),' duration ',formatfloat('0.000',(mmtime_lastsyncqpc-mmtime_prev_lastsyncqpc)),' ',formatfloat('0.00000000',jump/(mmtime_lastsyncqpc-mmtime_prev_lastsyncqpc)));}\r
\r
f := result;\r
end;\r
\r
result := f;\r
\r
- if (result < mmtime_lastresult) then result := mmtime_lastresult + 0.000001;\r
+ if (result < mmtime_lastresult) then result := mmtime_lastresult;\r
mmtime_lastresult := result;\r
end;\r
\r