GetTickCount: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | |||
This function returns amount of time that your system has been running in milliseconds. By comparing two values of [[getTickCount]], you can determine how much time has passed (in milliseconds) between two events. This could be used to determine how efficient your code is, or to time how long a player takes to complete a task. | This function returns amount of time that your system has been running in milliseconds. By comparing two values of [[getTickCount]], you can determine how much time has passed (in milliseconds) between two events. This could be used to determine how efficient your code is, or to time how long a player takes to complete a task. | ||
Line 10: | Line 11: | ||
==Example== | ==Example== | ||
This example shows how you can benchmark some code to see how long it takes to run. | This example shows how you can benchmark some code to see how long it takes to run. | ||
<syntaxhighlight lang="lua">getTickStart = getTickCount ( ) | <syntaxhighlight lang="lua">local getTickStart = getTickCount () | ||
-- Insert your code here | -- Insert your code here | ||
getTickEnd = getTickCount ( ) | local getTickEnd = getTickCount () | ||
outputChatBox ( "Time elapsed: " .. | outputChatBox ( "Time elapsed: " .. getTickEnd - getTickStart .. " milliseconds" )</syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Utility functions}} | {{Utility functions}} |
Revision as of 16:22, 10 August 2007
This function returns amount of time that your system has been running in milliseconds. By comparing two values of getTickCount, you can determine how much time has passed (in milliseconds) between two events. This could be used to determine how efficient your code is, or to time how long a player takes to complete a task.
Syntax
int getTickCount ()
Returns
Returns an integer containing the number of milliseconds since the system the server is running on started. This has the potential to wrap-around.
Example
This example shows how you can benchmark some code to see how long it takes to run.
local getTickStart = getTickCount () -- Insert your code here local getTickEnd = getTickCount () outputChatBox ( "Time elapsed: " .. getTickEnd - getTickStart .. " milliseconds" )
See Also
- addDebugHook
- base64Decode
- base64Encode
- debugSleep
- decodeString
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getRealTime
- getTickCount
- getTimerDetails
- getTimers
- getFPSLimit
- getUserdataType
- getVersion
- gettok
- isTransferBoxVisible
- setTransferBoxVisible
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isTimer
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- resetTimer
- setDevelopmentMode
- setFPSLimit
- setTimer
- ref
- deref
- sha256
- split
- teaDecode
- teaEncode
- toJSON
- tocolor
- getProcessMemoryStats
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub
- bitAnd
- bitNot
- bitOr
- bitXor
- bitTest
- bitLRotate
- bitRRotate
- bitLShift
- bitRShift
- bitArShift
- bitExtract
- bitReplace