The sum of his two reigns , 45 years and 21 days , is the longest in modern Spanish history .
His reign of 45 years and 21 days is the longest in modern Spanish history .