Because the Earth takes a little over 364 days to orbit the Sun, we need to make adjustments to keep the seasons from drifting: leap years and even leap seconds.
To be a leap year, the year number must be divisible by four – except for end-of-century years, which must be divisible by 400. (So the year 2000 was a leap year, although 1900 was not.) 2016, 2020, 2024 are all leap years.
The first leap year
The first leap year in the modern sense in Britain was 1752, when 11 days were 'lost' from the month September with the adoption of the Gregorian calendar by Britain and her colonies.
After 1752 we adopted the system still in use today where an additional day is inserted in February in years wholly divisible by four, other than years ending in 00 with the exception of those divisible by 400 which are still leap years (like 2000).
This is certainly not the first use of leap years; the Julian calendar we used before 1752 had a simpler system of leap years, and remember, no calendar is universal. The Islamic calendar Al-Hijra also has an extra day added to the 12th month Zul Hijja on leap years.
The calendar year is 365 days long, unless the year is exactly divisible by four, in which case an extra day is added to February to make the year 366 days long. The reason for these rules is to bring the average length of the calendar year into line with the length of the Earth's orbit around the Sun, so that the seasons always occur during the same months each year.
The year is defined as being the interval between two successive passages of the Sun through the vernal equinox. Of course, what is really occurring is that the Earth is going around the Sun once but it is easier to understand what is happening by considering the apparent motion of the Sun in the sky.
The Julian and Gregorian calendars
In 46 BC Julius Caesar established the Julian calendar, which was used in the west until 1582. In the Julian calendar each year contained 12 months and there were an average of 365.25 days in a year. This was achieved by having three years containing 365 days and one year containing 366 days. (In fact the leap years were not correctly inserted until 8 AD).
The discrepancy between the actual length of the year, 365.24237 days, and the adopted length, 365.25 days, may not seem important but over hundreds of years the difference becomes obvious. The reason for this is that the seasons, which depend on the date in the tropical year, were getting progressively out of kilter with the calendar date. Pope Gregory XIII, in 1582, instituted the Gregorian calendar, which has been used since then.
The Gregorian calendar also stipulated that the year should start on 1 January. In non-Catholic countries the change was made later; Britain and her colonies made the change in 1752 when 2 September was followed by 14 September and New Year's Day was changed from 25 March to 1 January.
A leap second was added on 31 December 2005, the first since 1998, to help keep clock-time aligned with time measured by the Sun. Another was added in 2008, 2012 and June 30 2015.
How can a tree change time?
The passage of time can now be measured with such accuracy that the rotation rate of the Earth can be seen to be variable. This can depend on the seasons (for example as trees grow, this affects the distribution of the mass of the Earth) and can even be dependent on weather conditions such as El Niño.
Since 1955, the most accurate clocks available have used an atomic transition in the gas caesium which defines a very accurately known frequency divided down to give seconds, minutes etc.