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

Constant Clock - by Rednet Works

Started by KronixGames, 18 August 2012 - 05:01 PM
KronixGames #1
Posted 18 August 2012 - 07:01 PM
Hello again friends, I'm here another day to show you guys more of a program 'Rednet Works', Constant Clock, the
Constant Clock aims to to instead of you having to stay when you want to see the time, is so you throw it on a computer just for him, and presto, he had been like a real digital clock!
I apologize again for my bad english, I'm still using the google translator!

donwload:

http://pastebin.com/LeuuGU77 - Constant-Clock

or copy the code:

function c()
term.clear()
term.setCursorPos(1,1)
end
c()
print("Constant Clock - by Rednet Works")
sleep(2)
c()
function clock()
  while true do
	sleep(0.003)
	nTime = os.time()
	print( textutils.formatTime(nTime, false) )
	sleep(0.003)
	c()
	clock()
  end
end
clock()

by Rednet Works
immibis #2
Posted 19 August 2012 - 08:59 AM
Wouldn't this overflow the stack after about 15 seconds? (assuming the maximum recursion depth is 255)
Sammich Lord #3
Posted 19 August 2012 - 09:05 AM
Wouldn't this overflow the stack after about 15 seconds? (assuming the maximum recursion depth is 255)
The reason for this is that if you look at the clock function he wrote it calls its self which is why there is a stack overflow.
Left4Cake #4
Posted 24 August 2012 - 08:37 PM
http://pastebin.com/x2zyNnTG

Removed the function calling it self.