C# Class GarrysModLuaShared.os

The os library is a standard Lua library originally intended to allow Lua access to various features of the Operating System it's running on, however many of the features and functions have been removed in Garry's Mod due to security issues. It's only used in Garry's Mod for date & time operations.
ファイルを表示 Open project: OmegaExtern/gmod-csharp-binary-module

Public Methods

Method Description
clock ( LuaState luaState ) : double

Returns the approximate CPU time the application run. This can be very useful for optimizing as you can use it to find out how long it took your function to run.

date ( LuaState luaState, string format, double time ) : string

Returns the date/time as a formatted string or in a table.

difftime ( LuaState luaState, double timeA, double timeB ) : double

Subtracts the second of the first value and rounds the result.

time ( LuaState luaState ) : double

Returns the system time in seconds past the unix epoch. If a table is supplied, the function attempts to build a system time with the specified table members.

Method Details

clock() public static method

Returns the approximate CPU time the application run. This can be very useful for optimizing as you can use it to find out how long it took your function to run.
public static clock ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
return double

date() public static method

Returns the date/time as a formatted string or in a table.
public static date ( LuaState luaState, string format, double time ) : string
luaState LuaState Pointer to lua_State struct.
format string /// The format string. /// /// If this is equal to '*t' then this function will return a table, otherwise it will return a string. /// /// If this starts with an '!', the returned data will use the UTC timezone rather than the local timezone. /// /// See http://www.mkssoftware.com/docs/man3/strftime.3.asp for available format flags. /// /// Not all flags are available on all operating systems and the result of using an invalid flag is undefined.This /// currently crashes the game on Windows.Most or all flags are available on OS X and Linux but considerably fewer are /// available on Windows.See http://msdn.microsoft.com/en-us/library/fe06s4ak.aspx for a list of available flags on /// Windows. ///
time double Time to use for the format.
return string

difftime() public static method

Subtracts the second of the first value and rounds the result.
public static difftime ( LuaState luaState, double timeA, double timeB ) : double
luaState LuaState Pointer to lua_State struct.
timeA double The first value.
timeB double The value to subtract.
return double

time() public static method

Returns the system time in seconds past the unix epoch. If a table is supplied, the function attempts to build a system time with the specified table members.
public static time ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
return double