Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Lua
➜ Question for Getinfo()
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Gpan
(4 posts) Bio
|
Date
| Mon 21 May 2018 06:24 AM (UTC) |
Message
| Hi all, i have a question for getinfo(),
EG. now is 2018/05/21 15:30:56, i want to know that what will be gotten by using the getinfo(232), a string or a number? the value is the same as the timestamp or something else. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 21 May 2018 10:38 PM (UTC) |
Message
| According to the documentation:
Quote:
232 - High-performance counter output (in seconds) (double)
That tells you that you will get a double returned (floating-point number) and that it will represent seconds.
The number of seconds is (I think) from when the PC booted, it is not anything to do with the current date or time.
It is intended for doing precise timing.
If you are using Lua you can get the exact same thing from utils.timer:
http://www.gammon.com.au/scripts/doc.php?lua=utils.timer
Example use:
start = utils.timer ()
-- OR
start = GetInfo (232)
-- do something here, like work out how to escape a maze
finish = utils.timer ()
-- OR
finish = GetInfo (232)
time_taken = finish - start -- in seconds and fractions of a second
The intention is really for debugging scripts, for example you might wonder if one complex regular expression is faster than lots of simple ones, or if LPEG is faster than a regular expression. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
9,969 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top