The first accurate mechanical clocks were made in 1656 by Dutch Scientist Christian Huygens. His later models were accurate to within one second per day. If he set the clocks daily by the sundial he may have initially thought that the clock was varying in accuracy at different times of the year when in fact it was the clock which was accurate and the sundial which was varying.
We now know that all clocks are continually 'out of step' with the sundial because day lengths, measured by the Sun, increase by a few seconds over a period of about three months then decrease by similar amounts over the next three months only to repeat the process for the next half year.
If you were to take a photograph on the same piece of film at ten day intervals at exactly 12 Noon on the clock you might expect to see something like the picture below.
The 'figure eight' is what would actually appear when the film was developed.The figure eight is called The Analemma.
The difference between Solar Time and Clock Time is referred to as The Equation of time. For practical purposes we need either a daily table of corrections in minutes & seconds for the sundial or a graph from which daily adjustments can be deduced.
The photograph shows how the times differ as the months pass.
A way this is often shown is as an 'Equation of Time' graph like this. You read along the month scale at the bottom and find the current date, then look up to see how many minutes to add or subtract. Often this graph will be included on the sundial.
If the Earth stayed in one place and just rotated on an upright axis then all days would have the same length. When we look at the Sun we are observing it from a moving platform. It is the varying speed around its elliptical orbit and the tilted axis which are responsible for the daily variations accounted for by the Equation of Time.
At some times, when the earth spins one complete rotation, it's movement around the orbit has moved it a bit further away from the sun, and it needs to rotate a little bit more before the sun is at its highest for your location. At other times it is moving more towards the sun, so the sun appears at its highest a bit before the full 24 hours has gone by.