Is it possible to run this \"indefinitely\", without causing stack overflow or running out of memory?
function eternal(){ var time = recalculateTime();
That should be fine. Once setTimeout runs it will return from the eternal function before it's calls it again.
setTimeout
eternal