This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Syli's profile picture

getting "real" timestamps

Started by Syli, 10 December 2012 - 05:44 AM
Syli #1
Posted 10 December 2012 - 06:44 AM
Hallo, i search for a way to get a more or less real timestamp. like time() in lua or timestamp() in php, its okay aswell, if you get the time sinze the cration of the world or something.

os.time() and os.clock() dont work, because they are not from a specific "start" time, so you cant calculate the time in between if for example the MC Server restarts!
Sure, i can run a loop wich increases a intiger every second or something like that, but that eats up Server CPU power!

thx for the help

greets Syli


edit http dont work for me because disabled!
CoolisTheName007 #2
Posted 10 December 2012 - 07:07 AM
The next version of CC will probably return server day in the call to os.time, according to several developers.
Cranium #3
Posted 10 December 2012 - 07:17 AM
Yeah, the only way I know how is through HTTP, with timeapi.org. Can't you convince the server owner to enable HTTP?
Syli #4
Posted 10 December 2012 - 08:07 AM
sure i can eventually, but i think its okay, to just wait until the day comes to ;)/>
snoble2022 #5
Posted 10 December 2012 - 09:55 AM
Just use textutils.formatTime(os.time(), true)
Cranium #6
Posted 10 December 2012 - 10:51 AM
Just use textutils.formatTime(os.time(), true)
That only returns minecraft time. Not IRL time, like the OP was needing.