Garry's Mod Wiki

CurTime

  number CurTime()

Description

Returns the uptime of the server in seconds (to at least 4 decimal places)

This is a synchronised value and affected by various factors such as host_timescale (or game.GetTimeScale) and the server being paused - either by sv_pausable or all players disconnecting.

You should use this function for timing in-game events but not for real-world events.

See also: RealTime, SysTime

Returns

1 number
Time synced with the game server.

Example

Simple delay timer.

local delay = 0 hook.Add( "Think", "CurTimeDelay", function() if CurTime() < delay then return end print( "This message will repeat every 5 seconds." ) delay = CurTime() + 5 end)
Output: This message will repeat every 5 seconds.