Miscellaneous API for Lua SDK
The methods on this page are utility methods that don't fit into other categories.
Time
This function will return a 17 digit precision Unix epoch.
Algorithm constructing the timetoken
1timetoken = (Unix epoch time in seconds) * 10000000
Example of creating a timetoken for a specific time and date:
108/19/2013 @ 9:20pm in UTC = 1376961606
2timetoken = 1376961606 * 10000000
3timetoken = 13769616060000000
Method(s)
To fetch Time you can use the following method(s) in Lua SDK:
1pubnub_obj:time(callback)
* required
| Parameter | Description |
|---|---|
callback *Type: function | Callback function to call with the received time (token). |
Sample code
Get PubNub timetoken
1pubnub_obj:time(function(t)
2 textout("Got timetoken: " .. t)
3end)