Squirrel/Server/Functions/Utils/GetTime

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function returns the number of seconds elapsed since January 1, 1970 (also known as the unix time). This function is useful for measuring longer time intervals. == Syntax =...)
 
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|GetTime}}
 
This function returns the number of seconds elapsed since January 1, 1970 (also known as the unix time). This function is useful for measuring longer time intervals.
 
This function returns the number of seconds elapsed since January 1, 1970 (also known as the unix time). This function is useful for measuring longer time intervals.
  

Revision as of 11:04, 11 October 2010

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function returns the number of seconds elapsed since January 1, 1970 (also known as the unix time). This function is useful for measuring longer time intervals.

Syntax

  1. int GetTime()

Arguments

  • none

Example

This example tells the player how many days have elapsed since January 1, 1970, when they type '/days'

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "days" )
  5. {
  6. MessagePlayer( "Did you know, that " + floor( GetTime() / 86400 ) + " days have elapsed since January 1, 1970?", player );
  7. }
  8. }
  9.  

Notes

The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox