os.clock

From GMod Wiki

Jump to: navigation, search
Function
Syntax os.clock( )
Where is this used?
Description:
Returns an approximation of the amount in seconds(with 3 decimals) of CPU time used by the program.
Returns: String
Part of Library: os
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Os.clock]Os.clock [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionTells a client to "Get a life" if they have been playing for over a day(approx.).
Used onNewerClient.png
Code
function backToReality()
	if (tonumber(os.clock()) > 86400) then
		LocalPlayer:ChatPrint("GO OUTSIDE, STOP PLAYING GMOD")
	end
end
hook.Add("Think", "gobacktoyourlife", backToReality)
Output"GO OUTSIDE, STOP PLAYING GMOD" after 24 hours.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox