Eventually the calendar was based on the number of day (that is 365 ¼ days) it takes the earth to go around the sun. The extra quarter of day began to cause of more confusions. Finally in 46B.C Julius Caesar ordered to count an extra day after every fourth year for balancing the confusion and in that way leap year arrived.
In the year 1582 Pope Gregory XIII ordered to keep calendar accurate for all future time and so he ruled that leap year should be skipped in the last year of every century unless that year could be divided by 400. That's why 1900 was not a leap year but 2000 was that. This system is called Gregorian calendar and is now used all over the world for daily purposes.