X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/935f8f3fc8915049b0bd70fdb9050bbd1ca65b7c..9e8179457b49de0ee52ab40192a88971fc3c01e6:/btime.pas?ds=sidebyside diff --git a/btime.pas b/btime.pas index 33b32d0..c130144 100644 --- a/btime.pas +++ b/btime.pas @@ -53,7 +53,7 @@ function unixtimefloat_systemtime:float; function oletounixfloat(t:float):float; function oletounix(t:tdatetime):integer; -function unixtoole(i:integer):tdatetime; +function unixtoole(i:float):tdatetime; {$ifdef win32} function mmtimefloat:float; @@ -130,7 +130,7 @@ begin result := trunc(oletounixfloat(t)); end; -function unixtoole(i:integer):tdatetime; +function unixtoole(i:float):tdatetime; begin result := ((i)/86400)+daysdifference; end; @@ -226,7 +226,7 @@ var f,g:float; o:tosversioninfo; isnt:boolean; - is9x:boolean; +{ is9x:boolean;} begin if (performancecountfreq = 0) then qpctimefloat; ticks_freq_known := false; @@ -239,7 +239,7 @@ begin o.dwOSVersionInfoSize := sizeof(o); getversionex(o); isnt := o.dwPlatformId = VER_PLATFORM_WIN32_NT; - is9x := o.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS; +{ is9x := o.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;} ticks_freq2 := f; mmtime_synchedqpc := false; @@ -327,14 +327,14 @@ const maxretries=5; margin=0.002; var - jump:float; - mm,f,qpc,newdrift,f1,f2:float; +{ jump:float;} + mm,f,qpc,newdrift:float; qpcjumped:boolean; - a,b,c:integer; - retrycount:integer; + a,b:integer; +{ retrycount:integer;} begin if not ticks_freq_known then measure_ticks_freq; - retrycount := maxretries; +{ retrycount := maxretries;} qpc := qpctimefloat; mm := mmtimefloat; @@ -351,7 +351,7 @@ begin mmtime_prev_lastsyncqpc := mmtime_lastsyncqpc; mm := mmtimefloat; - dec(retrycount); + { dec(retrycount);} settc; result := qpctimefloat; f := mmtimefloat; @@ -382,6 +382,7 @@ begin { mmtime_drift := mmtime_drift + mmtime_driftavg[a];} end; { mmtime_drift := mmtime_drift / b;} + a := 5; 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; mmtime_nextdriftcorrection := qpc + a; if (b >= 2) then warmup_finished := true; @@ -399,10 +400,10 @@ begin qpc := qpctimefloat; result := (qpc - mmtime_lastsyncqpc) * mmtime_drift + mmtime_lastsyncmm; - f := (qpc - mmtime_prev_lastsyncqpc) * mmtime_prev_drift + mmtime_prev_lastsyncmm; + {f := (qpc - mmtime_prev_lastsyncqpc) * mmtime_prev_drift + mmtime_prev_lastsyncmm; jump := result-f; - {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)));} + 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)));} f := result; end;