No one knows just when the earth is going to shake, rattle and roll. But even a few seconds notice would save many lives and money in a catastrophic earthquake.

Few places understand that better than California, where the next major quake is a matter of when, not if.

Predicting earthquakes is still science fiction.

But an earthquake this week in Southern California offered the latest evidence that quakes can be detected as they begin — a necessary first step toward establishing a reliable early warning system.

An early warning system currently being tested in California alerted scientists in Pasadena about 30 seconds before they began to feel the effects of a quake Monday morning in Riverside County, about 60 miles away.

"It was right," Kate Hutton, a seismologist with the California Institute of Technology, told the Los Angeles Times. "I sat really still to see if I could feel it, and it worked."

Because a warning can travel at the speed of light while a quake spreads at the speed of sound, scientists believe the system they're testing can provide up to 60 seconds notice before the arrival of damaging shock waves that can topple buildings and bridges. In that time, people could seek shelter or steer clear of overpasses, utilities could power down, pipeline valves could be closed and doors could be opened at fire stations to ensure that rescue equipment doesn't get trapped inside. The farther you are from the epicenter, the more time you'll have to prepare.

Japan already has an early warning system. Although thousands died in 2011 when a massive offshore quake spawned a tsunami that swamped coastal cities and villages, Japanese authorities say the loss of life would have been greater still without the earthquake alert.

In California, where millions of people live along the San Andreas fault and in other quake-prone areas, the benefits of a such a system are obvious. Scientists at Caltech and UC Berkeley are working with the U.S. Geological Survey to upgrade an existing network of seismic sensors to create one.

The estimated price tag is $80 million to develop it and $20 million a year for operations. Compare that to $6 billion in property damage from the 1989 Loma Prieta Quake or $13 billion from the 1994 Northridge quake and you see that it's a relatively small investment with a potentially big payoff.

Better still, a plan is in the works to raise the necessary money without tapping the state's general fund. State Sen. Alex Padilla, a Los Angeles Democrat, is sponsoring legislation for an early warning system, and he has his eyes on state special funds, federal grants and charitable foundations. He also is counting on investments from utilities, insurers and other businesses with a stake in limiting quake damage.

"We all know a big quake will hit again in the future," Padilla said at a news conference in February. "We should be smart and use our advanced science and technology to detect seismic activity and alert people in advance of an approaching quake."

Japan started its early-warning system in 2007. Taiwan, Mexico, Turkey, Romania, Italy and China also have warning systems in place or in the works.

California should, too.