how rock formations are created over time