Garry's Mod Wiki

SysTime

number SysTime()

Description

Returns a highly accurate time in seconds since the start up, ideal for benchmarking.

Returns

1 number
Uptime of the server.

Example

Prints the runtime

print(SysTime())
Output: 1654.4422888037

Example

Typical usage of this function for benchmarking

local SysTime = SysTime local Distance = FindMetaTable("Vector").Distance local vec1 = Vector(1, 2, 3) local vec2 = Vector(13, 26, -10) local count = 10000 local StartTime = SysTime() for i = 1, count do -- Repeat an action 10,000 times to check how long it takes on average -- Example action: Distance(vec1 , vec2) end local EndTime = SysTime() local TotalTime = EndTime - StartTime local AverageTime = TotalTime / count print("Total: " .. TotalTime .. " seconds. Average: " .. AverageTime .. " seconds.")
Output: Total: 0.0099969995115998 seconds. Average: 9.9969995115998e-07 seconds.

Page Links


Special Pages


Wikis

?

Render Time: 30ms

DB GetPage 3
Generate Html 5
SaveChanges (1) 8
Render Body 0
Render Sidebar 12