Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

GetTickCount()


Zzbrandon
 Share

Recommended Posts

Use timeGetTime, it's a lot better.

Add this declaration anywhere:

```

Public Declare Function timeGetTime Lib "winmm.dll" () As Long
```

And replace all instances of GetTickCount with timeGetTime.
Link to comment
Share on other sites

^^ He's got a very valid point. timeGetTime will vary far less than GetTickCount, we're talking mere miliseconds here mind you, but using timeGetTime will yeild the best results in varying environments. IE: My GetTickCount may process faster than yours, but if we're both using timeGetTime we should be relatively near the same. GetTickCount is faster to call than timeGetTime but timeGetTime will give you the best results across the board.
Link to comment
Share on other sites

> Timegettime is slower.

To initially call, yes, I agree, but in the long run it is a lot more efficient than GetTickCount and a lot more precise as Rob said.
Link to comment
Share on other sites

> But timeGettime still have 50days limit

Well everything has a 32bit long limit, even GetTickCount.

Just do something like this:

```
timeGetTime < Timer And timeGetTime >= StartTime
```
Link to comment
Share on other sites

> Wouldnt GetTickCount64 be the best to go with if you dont want to restart your cp in 50 days?

I added 64-bit timer with time roll-over (thx to Spodi´s code and JustinSD) to next ER, so wait until i release it ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)
Link to comment
Share on other sites

> Ironic? It´s converted to 32bit value in function.

It's still less precise than timeGetTime and still only goes up to a 32bit long because VB6 hasn't got any 64bit support. You can add rollover to any of the two but timeGetTime still has more advantages.
Link to comment
Share on other sites

> It's still less precise than timeGetTime and still only goes up to a 32bit long because VB6 hasn't got any 64bit support. You can add rollover to any of the two but timeGetTime still has more advantages.

VB6 have Currency, isn´t it 64-bit? Correct me if i am wrong.
Link to comment
Share on other sites

> GetTickCount64() does not exist on an XP machine, and your code WILL CRASH on them

Who said that i am using gettickcount64?

EDIT: Private Declare Sub GetSystemTime Lib "kernel32.dll" Alias "GetSystemTimeAsFileTime" (ByRef lpSystemTimeAsFileTime As Currency)
Link to comment
Share on other sites

> VB6 have Currency, isn´t it 64-bit? Correct me if i am wrong.

What I should of said is that the 64bit support is awful. Currency can hold the value of a 64bit integer, have fun using that in VB6.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...