Register forum user name Search FAQ

os.clock

Summary

Amount of elapsed/CPU time used (depending on OS)

Prototype

cpu = os.clock ()


Description

Returns the approximate amount of CPU time used by the current process in seconds.


print (os.clock () / 60 / 60) --> 34.381006944444 (hours)


WARNING - under Linux and Mac OS os.clock returns the CPU time used. However, under Windows it returns the elapsed time that the process has been running (not the CPU time used). This is because the operating system call "clock" works differently under Windows.


See Also ...

Lua functions

os.date - Formats a date/time string
os.difftime - Calculates a time difference in seconds
os.execute - Executes an operating system command
os.exit - Attempts to terminate the process
os.getenv - Returns an operating system environment variable
os.remove - Deletes a file
os.rename - Renames a file
os.setlocale - Sets the current locale to the supplied locale
os.time - Returns the current time or calculates the time in seconds from a table
os.tmpname - Returns a name for a temporary file

Topics

Lua base functions
Lua bc (big number) functions
Lua bit manipulation functions
Lua coroutine functions
Lua debug functions
Lua io functions
Lua math functions
Lua os functions
Lua package functions
Lua PCRE regular expression functions
Lua script extensions
Lua string functions
Lua syntax
Lua table functions
Lua utilities
Scripting
Scripting callbacks - plugins

(Help topic: lua=os.clock)

Documentation contents page


Search ...

Enter a search string to find matching documentation.

Search for:   

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.