Your high school teacher probably told that the light you see from shining stars is old—that it can take as much as 2,000 light years for a beam of starlight to reach Earth. But what about the stars themselves? How old are they?

Researchers at the Harvard-Smithsonian Center for Astrophysics have just published a paper in Nature identifying a newly proven method to measure the age of stars with remarkable accuracy. Termed gyrochronology and first proposed in the 1970s, the analytical procedure measures the relationship between the mass of a star against the rate of its rotation in order to pinpoint the length of its existence.

For some time, scientists have known how to measure the mass of a star. They’ve also learned that the rotation of a star slows down as it gets older. The trick, however, was figuring out how to best measure the spin. Researchers used NASA’s highly powerful Kepler Space telescope to observe and chart the changes in the brightness of spots on a star’s surface as they circled the celestial body.

They tested the theory on 30 stars in NGC 6819, a cluster known to be 2.5 million years old. Sydney Barnes, who co-authored the study with Soeren Meibom, told BBC News that the practice can nail down a star’s age “with only 10 percent uncertainty”—which is pretty significant, seeing that previous methods had a margin of error up to 100 percent.

Now that scientists have a more reliable way of knowing stellar age, they can better understand cosmic phenomena. The development might even help in the search for life beyond our solar system—since complex life takes billions of years to evolve, researchers may now be able to better identify candidate planets based on the age of the star they orbit.