Earliest uses of hydraulic engineering were to irrigate crops and dates back to the Middle East and Africa. Controlling the movement and supply of water for growing food has been used for many thousands of years. One of the earliest hydraulic machines, the water clock was used in the early 2nd millennium BC. Other early examples of using gravity to move water include the Qanat system in ancient Persia and the very similar Turpan water system in ancient China as well as irrigation canals in Peru.