As a challenge to myself I've been looking at writing my Competition bots in pascal. But I'm doing things like monte-carlo and genetic algorithms that need to be stopped within the time-limit allowed per turn. In C++ I've been using the high_precision_clock. It's equivalent in Pascal would probably be EpikTimer. However, it's not part of a standard library and thus has to be copies from source into my programs. That's quite a lot of code and I've read reports that in some cases it slows-down code up to factor 10!
I've also found QueryPerformanceCounter and GetMsCount, but both seem to be designed for Windows applications.
Function GetTimeInMilliSeconds(theTime : TTime): Int64; var Hour, Min, Sec, MSec: Word; begin DecodeTime(theTime,Hour, Min, Sec, MSec); Result := (Hour * 3600000) + (Min * 60000) + (Sec * 1000) + MSec; end; IntToStr(GetTimeInMilliSeconds(Time));
But to my understanding this is very inaccurate (25 ms error?)
Does anybody have and idea how to get ms-accurate timing in pascal?