The Poncelet problem and the discrete-time pendulum