RU/getRealTime: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
Line 2: | Line 2: | ||
__NOTOC__ | __NOTOC__ | ||
{{RU/Server client function}} | {{RU/Server client function}} | ||
Эта функция получает реальное время клиента либо сервера (Если используется на клиентской стороне, то он возвращает время, установленное на компьютере клиента) и возвращает его в таблицу. Если вы хотите получить внутриигровое время (Показанное на часах в GTA) используйте [[getTime]]. | |||
== | ==Синтаксис== | ||
<syntaxhighlight lang="lua">table getRealTime( [int seconds = current] )</syntaxhighlight> | <syntaxhighlight lang="lua">table getRealTime( [int seconds = current] )</syntaxhighlight> | ||
Revision as of 18:09, 22 October 2017
Эта функция получает реальное время клиента либо сервера (Если используется на клиентской стороне, то он возвращает время, установленное на компьютере клиента) и возвращает его в таблицу. Если вы хотите получить внутриигровое время (Показанное на часах в GTA) используйте getTime.
Синтаксис
table getRealTime( [int seconds = current] )
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- seconds: A count in seconds from the year 1970. Useful for storing points in time, or for retrieving time information for getBanTime. The valid range of this argument is 0 to 32,000,000,000
Returns
Returns a table of substrings with different time format or false if the seconds argument is out of range.
Member | Meaning | Range |
second | seconds after the minute | 0-61* |
minute | minutes after the hour | 0-59 |
hour | hours since midnight | 0-23 |
monthday | day of the month | 1-31 |
month | months since January | 0-11 |
year | years since 1900 | |
weekday | days since Sunday | 0-6 |
yearday | days since January 1 | 0-365 |
isdst | Daylight Saving Time flag | |
timestamp | seconds since 1970 (MTA 1.1 +) |
- tm_sec is generally 0-59. Extra range to accommodate for leap seconds in certain systems.
Example
This example outputs local time (server or client, where ever it was triggered) as hours and minutes
function showtime () local time = getRealTime() local hours = time.hour local minutes = time.minute outputChatBox ( "Local Time: "..hours..":"..minutes ) end
See Also
- addDebugHook
- base64Decode
- base64Encode
- debugSleep
- decodeString
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getRealTime
- getTickCount
- getTimerDetails
- getTimers
- getFPSLimit
- getUserdataType
- getVersion
- gettok
- isTransferBoxVisible
- setTransferBoxVisible
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isTimer
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- resetTimer
- setDevelopmentMode
- setFPSLimit
- setTimer
- ref
- deref
- sha256
- split
- teaDecode
- teaEncode
- toJSON
- tocolor
- getProcessMemoryStats
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub