\r
interface\r
\r
+{$ifdef win32}\r
+uses\r
+ ltimevalstuff;\r
+{$endif} \r
+\r
type\r
float=extended;\r
\r
function qpctimefloat:float;\r
{$endif}\r
\r
+{$ifdef win32}\r
+procedure gettimeofday(var tv:ttimeval);\r
+{$endif}\r
+\r
+\r
const\r
mmtime_driftavgsize=32;\r
mmtime_warmupnum=4;\r
{$else} {delphi 3}\r
{------------------------------ windows/delphi code to read time}\r
\r
+\r
+{simulate gettimeofday on windows so one can always use gettimeofday if preferred}\r
+\r
+procedure gettimeofday(var tv:ttimeval);\r
+var\r
+ e:extended;\r
+begin\r
+ e := unixtimefloat;\r
+ tv.tv_sec := round(int(e));\r
+ tv.tv_usec := trunc(frac(e)*1000000);\r
+ {just in case}\r
+ if (tv.tv_usec < 0) then tv.tv_usec := 0;\r
+ if (tv.tv_usec > 999999) then tv.tv_usec := 999999;\r
+end;\r
+\r
+\r
{\r
time float: gettickcount\r
resolution: 9x: ~55 ms NT: 1/64th of a second\r