If you’re looking for some kind of apocalyptic scenario to get anxious about, the Earth’s poles flipping is as good a nightmare as any. Scientists know that our planet’s poles have indeed flipped in the past, but how long it took for that to happen has long been a topic of debate.

Cheesy sci-fi movies depict the magnetic field shift as happening virtually overnight, and while researchers know that’s not the case it’s still hard to pin down an estimate. Now, a new study from researchers at the University of Wisconsin-Madison suggests that a pole flip which occurred around 770,000 years ago took tens of thousands of years to finish once it began.

Recent research has shown that we’re currently experiencing a shift in Earth’s magnetic field and that it’s happening a bit faster than scientists had predicted. It’s a natural process and there’s really nothing we can do about it, but knowing how long a polarity reversal will take is still worth knowing.

“Reversals are generated in the deepest parts of the Earth’s interior, but the effects manifest themselves all the way through the Earth and especially at the Earth’s surface and in the atmosphere,” Brad Singer, lead author of the study, said in a statement. “Unless you have a complete, accurate and high-resolution record of what a field reversal really is like at the surface of the Earth, it’s difficult to even discuss what the mechanics of generating a reversal are.”

This new study focused on global observations of ancient lava flows, deposits on the ocean floor, and even ice core samples from Antarctica to paint a vivid picture of how the magnetic field changed.

Based on all the data, the scientists now estimate that it took some 22,000 years for the most recent magnetic field reversal to complete, and it happened in a somewhat haphazard way. The reversal that locked us in the orientation we know today took just 4,000 years, but that was at the tail end of a period of instability in which the Earth experienced partial reversals lasting 18,000 years.