For what it's worth,
Allen's Astrophysical Quantities says ...
- Work required to dissipate solar matter to infinity: 6.6x1048 erg.
- Sun's total internal radiative energy: 2.8x1047 erg.
So the total gravitational energy of the sun appears to be about a factor of 30 in excess of the total radiant energy. Assuming the sun maintains a constant energy output of 3.845x10
33 erg/sec, the total internal radiative energy by itself would last about 2,300,000 years. But in any "realistic" scenario you have to dissipate a chunk of the gravitational energy as well, so the sun would really last somewhat longer under the constant luminosity assumption, which is likely not a very good assumption anyway.
As for how long it takes a photon to make the trip from the center to the surface, the numbers in this thread, on the order of 150,000 years are all much smaller than the numbers usually quoted in allegedly reliable sources that I have seen, which range from 500,000 to 1,000,000 years. Unfortunately, the one reliable source I have on hand (Foukal's
Solar Astrophysics) talks about radiative diffusion, but does not quote a number, and I am too lazy at the moment to try to figure it out myself. My guess is that the numbers on the order of 150,000 are a bit short due to simplifying assumptions, but I can't offer an allegedly superior number at the moment. But I do think that we have enough in the thread to point out that there is not any one "generally accepted" number, only a "generally accepted" order of magnitude.