For the earth to rotate about the sun takes exactly 365 days 5 hours 48 minutes and 45.9678 seconds, or 365.242199 days. Many ancient civilizations grappled with how to account for the extra .242199 days a year. The French add a day every so often as a celebration, the Mayans tried to incorporate it mathematically but were unsuccessful. Julius Cesar came up with the best plan he added an extra day every four years for leap Year. The problem is that adds .25 days not .242199. Over time that little inaccuracy builds up, at the rate of 7 days for every thousand years. Now this caused a tremendous amount of trouble for farmers who needed to know when to plant, and priests who needed to know when to celebrate holidays like Easter. So in 1578 Pope Gregory XIII convened a committee to fix the problem. The head of this committee was a Jesuit priest named Christopher Clavius. The solution Clavius came up with was neither complex nor elegant, but it did solve the problem. So in 1582 Pope Gregory eliminated 10 days from the calendar. The day after October 5, 1582 was October 15 1582. In addition he changed the start of the year from April 1st to January 1st. People who continued to believe April was the first day of the year were called 'April fools'
The second problem was how to keep the inaccuracy from creeping back into the calendar. The solution they proposed was taking back the extra day added by leap year at regular intervals. So for every century that is divisible by 400 has a leap year every century that isn't won't have a leap year. For example 1600 and 2000 will have a leap year, 1700, 1800, 1900, and 2100 will not. This solution was known as the Gregorian calendar and is still in use to this day.There is still one problem, this doesn't completely fix the problem, there are an extra 25.86 seconds every year. That small 25.86 seconds adds up and over 2800 years we will have an extra day to deal with.