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.
Function to get system time
Posted by Shadoweave on Wed 26 Sep 2007 08:27 PM — 9 posts, 33,790 views.
http://www.lua.org/pil/22.1.html
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
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.
In Lua, try using the os.date() function.
How do you get milliseconds with that? I might be missing something obvious, but I don't see it in the documentation...
Quote:
In Lua, try using the os.date() function.
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?
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.
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.
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.
I don't think standard C libraries, and therefore Lua, let you get time to less than 1 second resolution.