We have about 600 million years before we'd need to perform serious planetary engineering to remain on Earth and about a billion years before humanity must leave Earth to survive.

Right now, the greatest threat to our survival and prosperity is humanity itself.