# Change in Day Length with Latitude

As the Earth moves around the Sun, the length of the day (defined as the time between sunrise and sunset) changes. The extent to which it changes depends on latitude, as shown in the graph below:

As you can see, the length of a day changes far more during the year at higher latitudes than at lower latitudes. (Latitudes beyond 66°33′ are not shown because the Sun does not always rise or set at these latitudes.) The graph runs from one winter solstice to the next, with the two equinoxes clearly visible in March and September.

It’s quite interesting to look at by how much the length of a day changes every day. This graph would have the same shape as the previous one, but not if we look at percentage change. In a way, this gives an impression of how quickly it appears that “the nights are drawing in”.

At higher latitudes the length of day changes quite noticeably in early January and mid-November.  In some situations two adjacent days are different in length by nearly five minutes, and at some points the day loses nearly fourty minutes over the course of a single week.

# Leap smear

For reasons I have discussed before it is occasionally necessary to add* a leap second to the time, in order to keep the time on Earth in line with Earth’s inconsistent rotation.

Many systems require an accurate time to function correctly and the addition of a leap second can cause these systems to malfunction. In June 2012 the addition of a leap second caused a number of major websites such as Reddit, FourSquare, Yelp, LinkedIn, Gawker and StumbleUpon to malfunction and crash, but Google came up with a unique workaround – the Leap Smear – that prevented this from happening.

Google, like many others, uses the Network Time Protocol (NTP), to synchronise time across a network.† In order to cope with the leap second problem they configured their NTP servers to gradually add a small fraction of a second over a long period of time (in this case one day) so that at the end of this period their NTP servers’ time would have caught up with the adjusted time.

$t \left(\textnormal{Google}\right) = t + gain \left( 1 -cos \left( \pi \left( \frac{t}{window} \right) \right) \right)$

Where t(Google) is the time according to Google’s NTP servers; t is the actual UTC time; gain is the desired amount of gain time (in this case one second); and window is the time over which this gain should happen (in this case twenty-four hours).

The effect of using the cosine function is such that the time offset is small at first (in the first hour only four milliseconds are added) and gradually increases (to sixty-five milliseconds per hour at most) before decreasing again towards the end of the window.

This prevented servers and devices connected to Google’s NTP servers from “noticing” that something was wrong and applying their own corrections.

As they say in their blog post,

The leap smear is talked about internally in the Site Reliability Engineering group as one of our coolest workarounds, that took a lot of experimentation and verification, but paid off by ultimately saving us massive amounts of time and energy in inspecting and refactoring code. It meant that we didn’t have to sweep our entire (large) codebase, and Google engineers developing code don’t have to worry about leap seconds.

I wouldn’t be at all surprised to see others employing Google’s Leap Smear technique in the future.

* There are also provisions to subtract a leap second, but this has never yet happened.

† The NTP does contain a “leap indicator” but Google decided to force their NTP servers not to apply this.

# Dawn, dusk, sunrise, sunset and twilight

Dawn occurs before sunrise, before the top of the Sun reaches the horizon. Astronomical Dawn is the point at which it becomes possible to detect light in the sky, when the sun is 18° below the horizon. Nautical Dawn occurs at 12° below the horizon, when it becomes possible to see the horizon properly and distinguish some objects. Civil Dawn occurs when the sun is 6° below the horizon and there is enough light for activities to take place without artificial lighting.

Dusk occurs after sunset, once the top of the Sun has passed the horizon. As with dawn there is astronomical dusk, nautical dusk and civil dusk, occurring at 18°, 12° and 6° below the horizon respectively.

Twilight is the name given to the period between dawn and sunrise, or between sunset and dusk, when light is still visible in the sky due to sunlight scattering off the atmosphere. It can also be separated in astronomical, nautical and civil sections by how far below the horizon the Sun is.

Sunrise and sunset are the points at which the top edge of the Sun reaches the horizon; the only difference between them is the direction in which the Sun is moving at the time. It actually occurs when the top of the Sun is 0.57° below the horizon due to refraction of the Sun’s light by the atmosphere.

# Clockwise

Because the Earth rotates west to east, no matter where on Earth you are, the Sun rises in the east and sets in the west. In the northern hemisphere it passes through the south as it travels across the sky*, and in the southern hemisphere it passes through the north.

The first clocks that displayed the time (rather than measuring intervals of time) were simply sticks inserted vertically into the ground (gnomon). As the Sun moved across the sky the shadow cast by the stick would move across the ground; at midday the Sun would be at the south and the shadow would point north, to the “twelve o’clock” position.

An interesting consequence of this relates to the convention of “clockwise”:
If the development of the first clocks taken place in the southern hemisphere rather than in the northern hemisphere, clockwise and anticlockwise would be in opposite directions.

* Hence why, in the northern hemisphere, a south-facing garden is an attractive selling point for a house.

# Does time go faster as you get older?

Whilst two observers moving relative to each other will experience the other’s time as moving slower or faster (Einstein’s Theory of Special Relativity), the passage of time for any given observer in a single reference frame is constant.

But as you get older, time seems to go faster. This is because each subsequent day is a smaller fraction of your lifetime up to that point: for a one year-old baby, one day represents 0.274% of their lifetime; but for an eighty year-old adult one day is a mere 0.00343%.

The progression is easier to see on a logarithmic scale: