Pretty sure a 64-bit integer gets us to the death of our sun with several powers of 10 left over.
Sol won’t ever go nova, though, so I’m not sure how one would calculate the number of seconds until that happens.
Y2038, meanwhile, is just an artifact of the limitations of older hardware.
Let's be super safe and assume 128 bits will be sufficient for as long as the universe lasts. Whether humanity will still be around is a matter of debate.