Jump to content




System hour in CC



  • You cannot reply to this topic
6 replies to this topic

#1 TNTeener

  • Members
  • 20 posts

Posted 18 December 2012 - 10:42 PM

Can I program coomand, so os.clock() change while system hour change, and os.clock() is same as system hour?

#2 AfterLifeLochie

    Wiki Oracle

  • Moderators
  • 480 posts
  • LocationAfterLifeLochie's "Dungeon", Australia

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 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

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 TNTeener

  • Members
  • 20 posts

Posted 19 December 2012 - 01:14 AM

I can get Real Life hour (my real computer time) in cc computer?

#5 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

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 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

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 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

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:
<?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"






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users