A time loop or temporal loop is when someone has to re-experience a span of time indefinitely.
Sir Dan's time loop
After Sir Daniel Fortesque defeated Lord Palethorn in 1886 London, he and his love Princess Kiya decided to use the Professor's time machine to travel through time. However, due to a malfunction, Sir Dan and the Princess were separated. Dan ended up in 1286 Gallowmere, one day before the Battle of Gallowmere.
The fairies of the land enlisted Dan in helping them preserve the timeline by having him fend off a Jabberwocky attack on the Castle and swapping places with his still living self using a Body Swap Potion. This overrode the original timeline, where Gallowmere's Militia won by sheer luck, as well as all other realities where Zarok won; in this new reality, Dan's heroism before the battle inspired the King's Army enough to guarantee their victory.
By swapping himself with his cowardly living counterpart, Sir Dan became trapped in a time loop where he will always travel back in time after defeating Lord Palethorn to sacrifice himself at the battle of Gallowmere.