ElapsedMilliseconds()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

ElapsedMilliseconds()

Post 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
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: ElapsedMilliseconds()

Post 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.
bye,
Daniel
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: ElapsedMilliseconds()

Post by MachineCode »

Oh.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

Re: ElapsedMilliseconds()

Post 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.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: ElapsedMilliseconds()

Post 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.
BERESHEIT
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: ElapsedMilliseconds()

Post 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.
bye,
Daniel
Post Reply