To be used for archiving purposes only. No new posts will be made. View Scope's Farewell Message
Private Declare Function GetTickCount Lib "kernel32.dll" () As LongPrivate Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As Currency) As LongPrivate Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As Currency) As LongPublic Function GTC() As CurrencyStatic LastTick As Currency, BonusTick As CurrencyDim sysTick As Currency, sysFrequency As Currency If QueryPerformanceCounter(sysTick) And QueryPerformanceFrequency(sysFrequency) Then GTC = Int(sysTick / sysFrequency * 1000) Else GTC = GetTickCount If GTC < 0 Then GTC = GTC + 2147483468 'set the difference, longer its been negative higher the number is returned. If BonusTick = 0 Then LastTick = GTC - 1 'set the initial last tick If LastTick > GTC Then BonusTick = BonusTick + (2147483467 - LastTick) + GTC 'this suggest the tick rolled over either from positives to negatives or negatives to positive Else BonusTick = BonusTick + GTC - LastTick End If 'if last tick is greater than g t c then i subtract last tick from the max g t c value, then 'add the amount g t c has passed the max negative LastTick = GTC 'store last GTC = BonusTick End If End Function
your code will not work as expected if you execute your program while the computer was already 49+ days up. Consider using the API calls QueryPerformanceFrequency and QueryPerformanceCounter instead of GetTickCount.
I take that difference and add it onto 'BonusTick' which is the total tickcount except only for the bot
Why would it not work, and have you tried using this on a machine with 49+ days? I don't have one on hand but I tested on one that started in negatives and it worked fine. Please provide more information so that if there is a problem it can be looked into.PS: I read there are many other problems that can occur with QueryPerformance API.