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
➜ General
➜ Function to get system time
|
Function to get system time
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Shadoweave
(42 posts) Bio
|
| Date
| Wed 26 Sep 2007 08:27 PM (UTC) |
| Message
| | Hello, I was wondering what is the function that allows you to print the current system time, I want to add the time to my prompt. I have tried searching in the help file for this function, but I haven't found it, perhaps I have missed it. | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #1 on Wed 26 Sep 2007 08:42 PM (UTC) |
| Message
| | http://www.lua.org/pil/22.1.html |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Shadoweave
(42 posts) Bio
|
| Date
| Reply #2 on Thu 27 Sep 2007 05:52 AM (UTC) |
| Message
| | Thanks, but how do I get it to show the time in miliseconds too? I've only managed to get it to show the time in seconds | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #3 on Thu 27 Sep 2007 04:36 PM (UTC) |
| Message
| | By default, Lua doesn't provide the current system time in milliseconds because that information is (I believe) not ANSI C. I think this would require an addition by Nick to the API extensions. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| tobiassjosten
Sweden (79 posts) Bio
|
| Date
| Reply #4 on Thu 27 Sep 2007 04:47 PM (UTC) |
| Message
| | In Lua, try using the os.date() function. |
Simplicity is Divine | http://nogfx.org/ | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #5 on Thu 27 Sep 2007 04:58 PM (UTC) |
| Message
| | How do you get milliseconds with that? I might be missing something obvious, but I don't see it in the documentation... |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Shadoweave
(42 posts) Bio
|
| Date
| Reply #6 on Thu 27 Sep 2007 05:38 PM (UTC) |
| Message
|
Quote:
In Lua, try using the os.date() function.
I am using that to display the time, it doesn't display milliseconds
I've seen someone using GetInfo (232) and dividing it by 60, but it doesn't work correctly, it displays a minute having more than 60 seconds. Any ideas?
| | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #7 on Thu 27 Sep 2007 06:53 PM (UTC) Amended on Thu 27 Sep 2007 07:36 PM (UTC) by Zeno
|
| Message
| Perhaps Lua doesn't support it.
So I tried looking around in other languages. Python doesn't seem to have it either.
http://docs.python.org/lib/module-time.html
You may be able to take the raw time and divide it until you get ms. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Nick Gammon
Australia (23,166 posts) Bio
Forum Administrator |
| Date
| Reply #8 on Fri 28 Sep 2007 10:59 PM (UTC) |
| Message
| GetInfo (232) gives you a high resolution timer, but it isn't directly related to the system time.
I don't think standard C libraries, and therefore Lua, let you get time to less than 1 second resolution. |
- 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.
31,212 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top