no longer by default call TimeBeginPeriod(1) in btime init
[lcore.git] / btime.pas
index 8218e6415a97bf63f25a278f6c75ceb0ad95280c..87801b5416e3abba52d62e3832d7a3c59dc92ae6 100644 (file)
--- a/btime.pas
+++ b/btime.pas
@@ -12,6 +12,9 @@ unit btime;
 {$ifdef fpc}\r
   {$mode delphi}\r
 {$endif}\r
+\r
+{$include lcoreconfig.inc}\r
+\r
 interface\r
 \r
 {$ifdef mswindows}\r
@@ -57,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\r
 function timestrisoutc(i:float):string;          // 2012-08-15T14:21:09.255553Z\r
 \r
+procedure beginhightimerrate;\r
+procedure endhightimerrate;\r
+\r
 {$ifdef mswindows}\r
 function unixtimefloat_systemtime:float;\r
 {$endif}\r
@@ -762,10 +768,19 @@ begin
 \r
 end;\r
 \r
+procedure beginhightimerrate;\r
+begin\r
+  {$ifdef mswindows}timebeginperiod(1);{$endif}\r
+end;\r
+\r
+procedure endhightimerrate;\r
+begin\r
+  {$ifdef mswindows}timeendperiod(1);{$endif}\r
+end;\r
 \r
 procedure init;\r
 begin\r
-  {$ifdef mswindows}timebeginperiod(1);{$endif} //ensure stable unchanging clock\r
+  {$ifdef btimehighrate}beginhightimerrate;{$endif}\r
   fillchar(mmtime_driftavg,sizeof(mmtime_driftavg),0);\r
   settimebias := 0;\r
   gettimezone;\r