The Old Romans had built a machine (cart) which had a system of gears that measured the revolutions of the wheels and when so many revolutions had occurred the gears released a marble, 1 marble one mile.
I don't know if the Civil War engineers had such a device but the technology had been around for 1,900 yeras.