Squirrel/Client/Functions/Utils/GetTime

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|GetTime}} {{Squirrel/Deprecated|It is recommended that Squirrel's [http://squirrel-lang.org/doc/sqstdlib3.html#d0e1913 system library function], time() be used i…')
 

Latest revision as of 14:29, 29 April 2011

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

Note: This function is deprecated. Its use is discouraged as it may be removed in a future update. It is recommended that Squirrel's system library function, time() be used instead.

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.

[edit] Syntax

  1. int GetTime()

[edit] Arguments

  • none

[edit] Example

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

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

[edit] Notes

The function Message and call onClientCommand were used in this example. More info about them in the corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox