11 posts
Posted 18 July 2012 - 10:32 AM
Im working on a script for another server, and they want basically real time displayed on screen.
I can easily get the time of the server, using os.time() But I have no clue how to get real time.
Is it possible? And if so, how?
797 posts
Posted 18 July 2012 - 11:39 AM
os.clock() I think I.e.
k = os.clock()
print(k)
1548 posts
Location
That dark shadow under your bed...
Posted 18 July 2012 - 12:03 PM
I think you might have to use the http api to connect to a time server online, I haven't used that api so I am not sure but take a look
196 posts
Location
Norway
Posted 18 July 2012 - 02:23 PM
t = os.clock()
print(textutils.formatTime(t,[false/true])
false = AM/PM true = 24h
Edit:
If you want the real time from you computer read this:
http://www.lua.org/pil/22.1.html
515 posts
Location
Australia
Posted 18 July 2012 - 02:41 PM
t = os.clock()
print(textutils.formatTime(t,[false/true])
false = AM/PM true = 24h
Edit:
If you want the real time from you computer read this:
http://www.lua.org/pil/22.1.html
That doesn't apply to ComputerCraft's OS API
Also os.clock() returns with the time since the computercraft computer you are using turned on.
11 posts
Posted 18 July 2012 - 05:16 PM
Yeah, os.clock() shows time since the pc has been on. Ive never used the http api either, i have it enabled on the server though.
8543 posts
Posted 19 July 2012 - 01:58 AM
Yes, this is possible. It's even been
done before. You'll just have to click the stupid spoilers open. This isn't my code, so I can't vouch for it, but it claims to do what you're looking for.