Before the advent of railways in the 1800s, all time was local. Noon was simply when the sun was directly overhead wherever you were, in what is called solar time. Each town's citizens would set their clocks and pocket watches according to the official town clock or timekeeper. When they traveled to another town, they would simply change their watch when they arrived.
All that changed when railroads began to move people across great distances quickly. In the early days of the railroads, train schedules were totally confusing because they were based on local solar time. This problem was particularly pronounced in the United States and Canada where transcontinental railroads moved people over thousands of miles relatively quickly.
Clearly, it is no surprise then that the person considered the father of standardized time was a Canadian railway engineer. In 1878, Sir Sandford Fleming (1827–1915) developed the system of worldwide time zones that we still use today. He proposed that the world be divided into 24 time zones, each spaced 15º (fifteen degrees) of longitude apart (like 24 sections of an orange). He came to this idea because Earth completes a rotation every 24 hours and there are 360º of longitude, so each hour Earth rotates 1/24th of a circle or 15º.
As with many new ideas, his solution was not immediately embraced. Railroad companies in the U.S. finally began using Sir Fleming's standard time zones on November 18, 1883. An International Prime Meridian Conference was held in Washington, DC, in 1884 to standardize time around the world and select the Prime Meridian, or the meridian that is designated 0º from which all other longitudes are measured (often referred to as Greenwich Mean Time or GMT, because the place they chose as the Prime Meridian was Greenwich, England). The International Date Line, the imaginary line where travelers change from one date to another, is located at roughly 180º, exactly halfway around the world from Greenwich (conveniently drawn through the Pacific Ocean so no countries are divided into separate days).
In the United States, most states began adhering to the Eastern, Central, Mountain, and Pacific time zones by 1895, but the use of time zones did not become mandatory until Congress passed the Standard Time Act of 1918. Today the U.S. and its territories cover nine time zones. At one time, Alaska was broken up into four of the eight U.S. time zones, but in 1983, the entire state, except the westernmost Aleutians, was united into the 6th zone, Alaska standard time.
More recently, changes to standardized time have tried to take into account the fact that Earth's speed of rotation is slowing very gradually. In 1964 a new time scale called coordinated universal time (UTC) was adopted, which occasionally requires the addition of an extra second—the leap second—to the length of the UTC year.
While time zones are based on lines of longitude, some lines are drawn to avoid populated areas or to follow borders, and some countries have added their own variations because they don't want to be divided into several zones. In a few regions, the time kept is not one of the 24 standard time zones because half-hour or quarter-hour differences are in effect there. Variations also occur because different countries or regions have adopted daylight saving time.