Page 1 of 1

ElapsedMilliseconds()

Posted: Wed Jul 20, 2011 1:38 pm
by MachineCode
I've read that ElapsedMilliseconds() is a wrapper for GetTickCount_(). But the following article shows that GetTickCount_() is less accurate than timeGetTime_(), so my request is that ElaspedMilliseconds() becomes a wrapper for timeGetTime_() instead.

http://blogs.msdn.com/b/larryosterman/a ... ttime.aspx

Re: ElapsedMilliseconds()

Posted: Wed Jul 20, 2011 2:27 pm
by DarkDragon
It is a matter of libraries. PureBasic wants to generate small executables and if you wrap timeGetTime you would link to a completely different library.

Re: ElapsedMilliseconds()

Posted: Wed Jul 20, 2011 2:39 pm
by MachineCode
Oh.

Re: ElapsedMilliseconds()

Posted: Wed Jul 20, 2011 11:42 pm
by Thorium
DarkDragon wrote:It is a matter of libraries. PureBasic wants to generate small executables and if you wrap timeGetTime you would link to a completely different library.
I dont understand that. There is no difference in size if you import timeGetTime or getTickCount. Both are simple API imports.

Re: ElapsedMilliseconds()

Posted: Thu Jul 21, 2011 12:14 am
by netmaestro
It's a question of libraries to be sure, but I don't believe Fred's choice here was based on exe size. If I had to guess I'd say it's more a compatibility issue, as there have been numerous performance issues with winmm.lib (which timeGetTime uses) when linked in with programs running on Windows 2000. Here's a sample: http://support.microsoft.com/kb/266327

GetTickCount, from good old trusty kernel32, is the much safer choice and one I personally agree with. It's less overhead and the chances for trouble down the road are much less. The only capability you miss is that with timeGetTime you can adjust your accuracy with the use of timeBeginPeriod etc., otherwise they don't differ much. I guess the team figured that programmers who want to tap into the multimedia library can do that if they want to as it's already imported, and left the native command simple and safe.

Just my 2 cents, and inflation is eating away at that.

Re: ElapsedMilliseconds()

Posted: Thu Jul 21, 2011 6:38 am
by DarkDragon
Thorium wrote:
DarkDragon wrote:It is a matter of libraries. PureBasic wants to generate small executables and if you wrap timeGetTime you would link to a completely different library.
I dont understand that. There is no difference in size if you import timeGetTime or getTickCount. Both are simple API imports.
timeGetTime is afaik corresponding to winmm and GetTickCount is kernel32. Sure, the difference is small, but maybe that's the reason why it hasn't been done already. A few years ago I thought Fred would program a Demo/Intro-Scene language where every byte counts.