GetTickCount Rolls Back To Zero?

Hello!

Quote:

> Since VB uses a signed long will gettickcount roll back to zero after it

> reaches 2147483647? Will the following code work or does anyone see a more

No, It becames -2147483648.

Quote:

> efficient solution.

> Public Function GetTicks() As Single

> Static LastTick As Long

> Static Base As Single

> Dim NowTick As Long

> NowTick = GetTickCount()

> If NowTick < LastTick Then Base = Base + 2147483647

If NowTick < LastTick Then Base = Base + 4294967296

Quote:

> LastTick = NowTick

> GetTicks = Round(Base + CSng(NowTick) / 1000, 3)

> End Function

The precision of your function will decrease as value grows. I recommend you

to use Currency variables instead Single. It overflows after years.

Sergey Merzlikin