You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.8 KiB
90 lines
2.8 KiB
|
3 years ago
|
# LibTime-1.0 (WoW AddOn Library)
|
||
|
|

|
||
|
|

|
||
|
|

|
||
|
|

|
||
|
|
|
||
|
|
[](https://www.patreon.com/bePatron?u=12558524)
|
||
|
|
[](https://paypal.me/hizuro)
|
||
|
|

|
||
|
|
|
||
|
|
|
||
|
|
## Description
|
||
|
|
A little library around date, time and GetGameTime and more...
|
||
|
|
|
||
|
|
|
||
|
|
## To use in addons
|
||
|
|
```lua
|
||
|
|
lib = LibStub("LibTime-1.0")
|
||
|
|
```
|
||
|
|
|
||
|
|
## API
|
||
|
|
|
||
|
|
### GetGameTime
|
||
|
|
This library detecting the seconds of server time. The fourth return value is a boolean to signalize sycronization. It needs min. a minute to get sync from login.
|
||
|
|
```lua
|
||
|
|
hours, minutes, seconds, secondsSynced = lib.GetGameTime( )
|
||
|
|
```
|
||
|
|
|
||
|
|
### GetLocalTime
|
||
|
|
```lua
|
||
|
|
hours, minutes, seconds = lib.GetLocalTime( )
|
||
|
|
```
|
||
|
|
|
||
|
|
### GetUTCTime
|
||
|
|
```lua
|
||
|
|
GetUTCTime( [<inSeconds>] )
|
||
|
|
```
|
||
|
|
|
||
|
|
**Example:**
|
||
|
|
```
|
||
|
|
hours, minutes, seconds = lib.GetUTCTime( )
|
||
|
|
seconds = lib.GetUTCTime(true) -- seconds since 1.1.1970 0:00
|
||
|
|
```
|
||
|
|
|
||
|
|
**Arguments:**
|
||
|
|
inSeconds - (optional) boolean
|
||
|
|
|
||
|
|
**Return values:**
|
||
|
|
hours - integer
|
||
|
|
minutes - integer
|
||
|
|
seconds - integer
|
||
|
|
|
||
|
|
### GetCountryTime
|
||
|
|
```lua
|
||
|
|
GetCountryTime( <countryId>[, <inSeconds> ] )
|
||
|
|
```
|
||
|
|
**Examples:**
|
||
|
|
```lua
|
||
|
|
hours, minutes, seconds, countryName = lib.GetCountryTime( 98 )
|
||
|
|
seconds = lib.GetCountryTime(17,true)
|
||
|
|
```
|
||
|
|
|
||
|
|
### GetTimeString
|
||
|
|
```lua
|
||
|
|
GetTimeString("GameTime|LocalTime|UTCTime|CountryTime"[, b24Hours[, displaySeconds[, countryId]]])
|
||
|
|
```
|
||
|
|
|
||
|
|
**Examples:**
|
||
|
|
```lua
|
||
|
|
"00:00" = lib.GetTimeString("GameTime",true)
|
||
|
|
"00:00:00" = lib.GetTimeString("LocalTime",true,true)
|
||
|
|
"00:00:00 AM" = lib.GetTimeString("UTCTime",false,true)
|
||
|
|
"00:00 PM" = lib.GetTimeString("CountryTime",false,false,23)
|
||
|
|
```
|
||
|
|
|
||
|
|
### iterateCountryList
|
||
|
|
```lua
|
||
|
|
for id, name in lib.iterateCountryList() do
|
||
|
|
end
|
||
|
|
```
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
## My other projects
|
||
|
|
* [On Curseforge](https://www.curseforge.com/members/hizuro_de/projects)
|
||
|
|
* [On Github](https://github.com/HizurosWoWAddOns?tab=repositories)
|
||
|
|
|
||
|
|
## Disclaimer
|
||
|
|
> World of Warcraft© and Blizzard Entertainment© are all trademarks or registered trademarks of Blizzard Entertainment in the United States and/or other countries. These terms and all related materials, logos, and images are copyright © Blizzard Entertainment.
|