X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/8cccf85821f547f5cb8abb81b499e4bb0ffbacc4..309429a3acfa50bd4e928b8a5728dc863e9c767b:/btime.pas?ds=sidebyside diff --git a/btime.pas b/btime.pas index ff77de9..87801b5 100644 --- a/btime.pas +++ b/btime.pas @@ -9,6 +9,11 @@ works on windows/delphi, and on freepascal on unix. unit btime; +{$ifdef fpc} + {$mode delphi} +{$endif} + +{$include lcoreconfig.inc} interface @@ -55,6 +60,9 @@ function timestrshort(i:tunixtimeint):string; // Wed Aug 15 16:21:09 2012 function timestriso(i:tunixtimeint):string; // 2012-08-15 16:21:09 function timestrisoutc(i:float):string; // 2012-08-15T14:21:09.255553Z +procedure beginhightimerrate; +procedure endhightimerrate; + {$ifdef mswindows} function unixtimefloat_systemtime:float; {$endif} @@ -105,9 +113,7 @@ var implementation -{$ifdef fpc} - {$mode delphi} -{$endif} + uses {$ifdef UNIX} @@ -762,10 +768,19 @@ begin end; +procedure beginhightimerrate; +begin + {$ifdef mswindows}timebeginperiod(1);{$endif} +end; + +procedure endhightimerrate; +begin + {$ifdef mswindows}timeendperiod(1);{$endif} +end; procedure init; begin - {$ifdef mswindows}timebeginperiod(1);{$endif} //ensure stable unchanging clock + {$ifdef btimehighrate}beginhightimerrate;{$endif} fillchar(mmtime_driftavg,sizeof(mmtime_driftavg),0); settimebias := 0; gettimezone;