getRealTime
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function gets the server or client (if used client sided it returns time as set on client's computer) real time and returns it in a table. If you want to get the in-game time (shown on GTA's clock) use getTime.
The seconds parameter can be left out entirely while still using the localTime parameter. To achieve that simply pass the boolean localTime parameter as first argument where you would otherwise pass the seconds parameter. This way you can retrieve a current timepoint that is not denoted in local time.
Syntax
table getRealTime ( [ int seconds = current, bool localTime = true ] )Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- seconds (default: current): 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
- localTime (default: true): MISSING_PARAM_DESC
Returns
- table: value
Returns a table of substrings with different time format or false if the seconds argument is out of range.
Code Examples
This example adds 'showtime' like the default MTA 'time' command:
function showtime () local time = getRealTime() local hours = time.hour local minutes = time.minute local seconds = time.second
-- use string.format to keep it 2 digits. eg 1 will be converted to 01 outputChatBox ( string.format("Local Time: %02d:%02d:%02d", hours, minutes, seconds) )endaddCommandHandler("showtime", showtime)See Also
Utility Functions
- addDebugHook
- bitAnd
- bitArShift
- bitExtract
- bitLRotate
- bitLShift
- bitNot
- bitOr
- bitReplace
- bitRRotate
- bitRShift
- bitTest
- bitXor
- createTrayNotification
- debugSleep
- decodeString
- deref
- downloadFile
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getFPSLimit
- getKeyboardLayout
- getLocalization
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getProcessMemoryStats
- getRealTime
- getServerIp
- getTickCount
- getTimerDetails
- getTimers
- gettok
- getUserdataType
- getVersion
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isShowCollisionsEnabled
- isShowSoundEnabled
- isTimer
- isTimerPaused
- isTransferBoxAlwaysVisible
- isTransferBoxVisible
- isTrayNotificationEnabled
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- ref
- removeDebugHook
- resetTimer
- setClipboard
- setDevelopmentMode
- setFPSLimit
- setTimer
- setTimerPaused
- setTransferBoxVisible
- setWindowFlashing
- sha256
- showCol
- showSound
- split
- teaDecode
- teaEncode
- tocolor
- toJSON
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub