Garry's Mod Wiki


  number CurTime()


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

This is internally defined as a float, and as such it will be affected by precision loss if your server uptime is more than 6 hours, which will cause jittery movement of players and props and inaccuracy of timers, it is highly encouraged to refresh or change the map when that happens (a server restart is not necessary).

This is NOT easy as it sounds to fix in the engine, so please refrain from posting issues about this

This returns 0 in GM:PlayerAuthed.

Issue Tracker: 3026


1 number
Time synced with the game server.


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.