block by mbostock c2b2a129696be78830d8

T-minus Time

Full Screen

Although we think of time as absolute—a specific moment—computers typically represent time relative to a particular epoch. The most common epoch is the Unix epoch of 00:00:00 UTC on January 1, 1970.

Sometimes, however, we may want to display time relative to a particular event, such as T-minus time for a rocket launch. This example demonstrates how to go back and forth betwen the two time spaces, converting standard UTC times to relative times. Note that we want to compute the axis ticks relative to the epoch, too. Since the relative time space is simply a translation of the absolute time space (i.e., both have exactly 24 hours a day), a second translated time scale can be used to compute the ticks while keeping the primary time scale in absolute time.

index.html