WoW:API GetTime: Difference between revisions
Jump to navigation
Jump to search
GetTime -Documentation by Zlixar- -Updated by RoQ-
No edit summary |
(getTime() elaboration) |
||
| Line 22: | Line 22: | ||
:''Added by [[user:RoQ|RoQ]]:'' | :''Added by [[user:RoQ|RoQ]]:'' | ||
:It's plausible to use GetTime() as a timestamp, in those cases where you want to verify that one thing has happened before or after another. The only exception to this is when the value of [[API GetDate|GetDate()]] changes, then (obviously) the value of GetTime() has no relationship to the value before [[API GetDate|GetDate()]] changed. | :It's plausible to use GetTime() as a timestamp, in those cases where you want to verify that one thing has happened before or after another. The only exception to this is when the value of [[API GetDate|GetDate()]] changes, then (obviously) the value of GetTime() has no relationship to the value before [[API GetDate|GetDate()]] changed. | ||
---- | |||
=== Get Time === | |||
Like most functions in WoW I believe that getTime() returns the amount of time in milliseconds since either A) the game has started OR B) your session has begun. The function getDate() returns the date (day precision) of the last patch released by Blizzard, so using it to calculate the real time would be difficult. | |||
local date = GetDate(); | |||
local time = GetTime(); | |||
scrollBox:AddMessage("test "..(time/60)..date); | |||
Returns something like | |||
test 80.16573333333 Feb 15 2005 | |||
Notice how I devided time by 60 to get approximate minutes. It's almost a month from Feb 15 2005 currently so I think getDate() and getTime() serve two very different purposes. | |||
---- | ---- | ||
{{Template:WoW API}} | {{Template:WoW API}} | ||
Revision as of 20:06, 19 March 2005
When called, returns the elapsed time in seconds from the "epoch" given by GetDate().
elapsedSeconds = GetTime();
- Arguments
- None
- Returns
- elapsedSeconds
- Floating Point Number - The elapsed time in seconds from the "epoch" (or "zero-hour") which is determined by GetDate().
- Example
seconds = GetTime();
print("Current system uptime is: "..seconds.." seconds!");
- Result
Current system uptime is: 60123 seconds!
- Details
- This is relatively unconfirmed, though experimentation on my part has failed to find any fault in this correlation. It may, however, be possible that this tracks something such as current session uptime (as opposed to total system uptime). Any confirmation or corrections appreciated ^.^
- Added by RoQ:
- It's plausible to use GetTime() as a timestamp, in those cases where you want to verify that one thing has happened before or after another. The only exception to this is when the value of GetDate() changes, then (obviously) the value of GetTime() has no relationship to the value before GetDate() changed.
Get Time
Like most functions in WoW I believe that getTime() returns the amount of time in milliseconds since either A) the game has started OR B) your session has begun. The function getDate() returns the date (day precision) of the last patch released by Blizzard, so using it to calculate the real time would be difficult.
local date = GetDate();
local time = GetTime();
scrollBox:AddMessage("test "..(time/60)..date);
Returns something like
test 80.16573333333 Feb 15 2005
Notice how I devided time by 60 to get approximate minutes. It's almost a month from Feb 15 2005 currently so I think getDate() and getTime() serve two very different purposes.