Can I program coomand, so os.clock() change while system hour change, and os.clock() is same as system hour?
6 replies to this topic
#1
Posted 18 December 2012 - 10:42 PM
#2
Posted 18 December 2012 - 11:54 PM
Moved to the Ask a Pro section - it's best to ask questions like this over there, and not in General.
#3
Posted 19 December 2012 - 12:36 AM
Are you asking if you can get the time of your local computer (Real life and not MC time)?
#4
Posted 19 December 2012 - 01:14 AM
I can get Real Life hour (my real computer time) in cc computer?
#5
Posted 19 December 2012 - 01:58 AM
nope, the only way to do that is to use the http interface to access the internet and get the time there
#6
Posted 19 December 2012 - 03:39 AM
Yeah you would have to connect to a php website or something. I asked the same question a while back, too.
#7
Posted 19 December 2012 - 04:52 AM
Indeed, easiest way is to sign up at 000webhost.com or any other hosting service and creating a file 'time.php' with simple content like this:
And in Lua something like:
<?php
date_default_timezone_set('UTC'); // use correct timezone
echo date('h:i:s A', time()); // gives something like '05:12:54 PM'
?>
And in Lua something like:
local content = http.get("http://www.example/com/time.php")
local time = (content~=nil) and content.readAll() or "time server couldn't be reached"
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











