---
title: Declock
description: >
Introducing Declock, a timekeeping system
that displays time in decimal days without
the need for hours, minutes, or seconds.
image: /asset/daywide.svg
url: https://maptv.github.io/dec/time
decdate: 2026+242
path: /dec/time
slug: time
aliases:
- /time
- /dt
engine: knitr
draft: true
---
::: {.timenav}
{{< include /asset/_decnav.qmd >}}
:::
# Declock {#declock .hiddenheading}
My website provides many examples of the [Quarto](https://quarto.org) publishing and the [Dec](/dec) measurement systems in action. I leverage Quarto support for the [Observable](https://observablehq.com/) data analysis and visualization system to create animated and interactive graphics like the [bar📊charts](https://en.wikipedia.org/wiki/Bar_chart) clocks🕓, [solar☀️terminator](https://en.wikipedia.org/wiki/Terminator_%28solar%29#:~:text=a%20moving%20line%20that%20divides%20the%20daylit%20side%20and%20the%20dark%20night%20side%20of%20a%20planetary%20body) map🗺, [Earth🌍orbit](https://en.wikipedia.org/wiki/Earth%27s_orbit) diagram, and [daylight](https://en.wikipedia.org/wiki/Daylight#:~:text=the%20combination%20of%20all%20direct%20and%20indirect%20sunlight%20during%20the%20daytime) [area chart](https://en.wikipedia.org/wiki/Area_chart#:~:text=The%20area%20between%20axis%20and%20line%20are%20commonly%20emphasized%20with%20colors) below.
::: {.column-margin .clocks #onlymargin .posneg}
\${posclock}\${negclock}
:::
Dec times are measured in [fractional days](https://en.wikipedia.org/wiki/Decimal_time#Fractional_days:~:text=a%20decimal%20fraction%20of%20a%20day), often using [metric prefixes](https://en.wikipedia.org/wiki/Metric_prefix#:~:text=a%20unit%20prefix%20that%20precedes%20a%20basic%20unit%20of%20measure%20to%20indicate%20a%20multiple%20or%20submultiple%20of%20the%20unit) like [deci](https://en.wikipedia.org/wiki/Deci-#:~:text=a%20decimal%20unit%20prefix%20in%20the%20metric%20system%20denoting%20a%20factor%20of%20one%20tenth), [centi](https://en.wikipedia.org/wiki/Centi-#:~:text=a%20unit%20prefix%20in%20the%20metric%20system%20denoting%20a%20factor%20of%20one%20hundredth), or [milli](https://en.wikipedia.org/wiki/Milli-#:~:text=a%20unit%20prefix%20in%20the%20metric%20system%20denoting%20a%20factor%20of%20one%20thousandth). The top, middle, and bottom bars indicate the [decidays](https://en.wikipedia.org/wiki/Decimal_time#:~:text=dividing%20the%20day%20into%2010%20decidays){.tool data-bs-toggle="tooltip" data-bs-title="tenths of a day"}, [millidays](https://en.wikipedia.org/wiki/Unit_of_time#:~:text=1.44%20minutes%2C%20or%2086.4%20seconds){.tool data-bs-toggle="tooltip" data-bs-title="thousandths of a day"}, and [centimillidays](https://en.wikipedia.org/wiki/Decimal_time#:~:text=which%20would%20be-,1/100%2C000%20day,-%2C%20or%20864%20milliseconds){.tool data-bs-toggle="tooltip" data-bs-title="hundred thousandths of a day"}, respectively, of the time since the start, \${decPosHsl()}, or until the end, \${decNegHsl()}, of the day in the Zone \${decZoneHsl}, the Dec [time zone](https://en.wikipedia.org/wiki/Time_zone#:~:text=an%20area%20which%20observes%20a%20uniform%20standard%20time) selected by the red⭕️circle on the map beneath the bars.
To rotate the globe🌐in the Earth🌏orbit diagram, drag the red circle horizontally↔️or slide the red🔴dot on the daylight area chart vertically↕. The red circle's vertical position determines the yearly daylight pattern visualized by the area chart. Shift the vertical red<font color=red>—</font>line on the area chart horizontally to move the globe along the ellipse of the Earth🌎orbit.
{{< include /dec/time/_timecharts.qmd >}}
# Annual day aggregate (ada) {#sec-ada .hiddenheading}
The red line indicates a "day of year" ([doy](#doy){#dayofyear .tool data-bs-toggle="tooltip" data-bs-title="day of year"}): \${selDateHsl()}, which identifies a day in a year like a [Gregorian calendar](https://en.wikipedia.org/wiki/Gregorian_calendar#:~:text=the%20calendar%20used%20in%20most%20parts%20of%20the%20world) month and "day of month" ([dom](#dom){#dayofmonth .tool data-bs-toggle="tooltip" data-bs-title="day of month"}). The red dot denotes a "time of day" ([tod](#tod){#timeofday .tool data-bs-toggle="tooltip" data-bs-title="time of day"}): \${selTimeDay()}, which specifies a point in a day like an "hour minute second" ([hms](#hms){#hourminutesecond .tool data-bs-toggle="tooltip" data-bs-title="hour minute second"}) triplet. Together, a [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="day of year"} and [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} can form an "annual day aggregate" ([ada](#ada){#annualdayaggregate .tool data-bs-toggle="tooltip" data-bs-title="annual day aggregate"}): \${selDateHsl()} + \${selTimeDay()} ÷ 1000 = \${selDatePadHsl()}.\${selTimeMilDay()}.
::: {.equationgroup #equationgroup00}
$$
\begin{split}
\text{doy} &= \lfloor\text{ada}\rfloor \\
&= \text{ada} - \text{tod}
\end{split}
$$ {#eq-ada}
:::
As their names suggest, [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="days of year"} and [ada](#ada){.tool data-bs-toggle="tooltip" data-bs-title="annual day aggregates"} are measured in days. The [measurement unit](https://en.wikipedia.org/wiki/Unit_of_measurement#:~:text=a%20definite%20magnitude%20of%20a%20quantity) of a [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} can be a day or a [submultiple](https://en.wikipedia.org/wiki/Multiple_%28mathematics%29#Submultiple:~:text=of%20%22a%20being-,a%20unit%20fraction,-of%20b%22%20) of a day with a metric prefix. By changing how a decimal [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} is measured, we can shift its [decimal separator](https://en.wikipedia.org/wiki/Decimal_separator#:~:text=a%20symbol%20that%20separates%20the%20integer%20part%20from%20the%20fractional%20part%20of%20a%20number) or turn it into an integer. The [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="times of day"} along the y-axis of the area chart are integers because they have three digits and are measured in [millidays]{.tool data-bs-toggle="tooltip" data-bs-title="thousandths of a day"}.
# Epochal day aggregate (eda) {#sec-eda .hiddenheading}
To obtain a [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} from an [ada](#ada){.tool data-bs-toggle="tooltip" data-bs-title="annual day aggregate"}, we can [keep the remainder after dividing](https://en.wikipedia.org/wiki/Modulo#:~:text=returns%20the%20remainder) by one to isolate the [decimal part](https://en.wikipedia.org/wiki/Fractional_part#:~:text=the%20excess%20beyond%20that%20number%27s%20integer%20part) of the [quotient](https://en.wikipedia.org/wiki/Quotient#:~:text=a%20quantity%20produced%20by%20the%20division%20of%20two%20numbers): \${zeroDotyHsl()}.\${zeroTpadHsl()} [mod](https://en.wikipedia.org/wiki/Modulo#:~:text=returns%20the%20remainder) 1 = 0.\${zeroTpadHsl()}. We can use this same approach to separate a [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} from an "epochal day aggregate" ([eda](#eda){#epochaldayaggregate .tool data-bs-toggle="tooltip" data-bs-title="epochal day aggregate"}): \${zeroDoteHsl}.\${zeroTpadHsl()} mod 1 = 0.\${zeroTpadHsl()}. The current [eda](#eda){.tool data-bs-toggle="tooltip" data-bs-title="epochal day aggregate"} tells us how many days have passed since the Dec [epoch](https://en.wikipedia.org/wiki/Epoch#:~:text=an%20instant%20in%20time%20chosen%20as%20the%20origin%20of%20a%20particular%20calendar%20era): Year [0]{.color0} Day [0]{.color0} [Tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} [0]{.color0}.
::: {.equationgroup #equationgroup01}
$$\begin{split}
\text{tod} &= \text{ada} \bmod 1 \\
&= \text{eda} \bmod 1
\end{split}$$ {#eq-tod}
:::
## UNIX time equation {#sec-ute .unnumbered .hiddenheading}
Similarly, [UNIX time](https://en.wikipedia.org/wiki/Unix_time#:~:text=the%20number%20of%20non%2Dleap%20seconds%20that%20have%20elapsed%20since%2000%3A00%3A00%20UTC%20on%201%C2%A0January%201970%2C%20the%20Unix%20epoch) tallies the seconds since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time#:~:text=00%3A00%3A00%20UTC%20on%201%C2%A0January%201970), which is exactly 719468 days after the Dec epoch. To get the [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} in Zone [0]{.color0}, the Dec time zone that is in between the two leftmost vertical lines on the map, we can divide UNIX time by the [number of seconds in a day](https://en.wikipedia.org/wiki/Day#:~:text=average%2C%20this%20is-,24%20hours%20(86%2C400%20seconds),-.%20As%20a%20day) and then keep the remainder after dividing the resulting days by 1 as in @eq-unixtod.
::: {.equationgroup #equationgroup02}
$$\text{tod} = \text{unix} \div 86400 \bmod 1$$ {#eq-unixtod}
:::
## Julian date equation {#sec-jde .unnumbered .hiddenheading}
[Julian dates](https://en.wikipedia.org/wiki/Julian_day#:~:text=the%20Julian%20day%20number%20plus%20the%20fraction%20of%20a%20day%20since%20the%20preceding%20noon) track the days since the beginning of the [Julian period](https://en.wikipedia.org/wiki/Julian_day#:~:text=a%20chronological%20interval%20of%207980%C2%A0years%2C%20derived%20from%20three%20multi%2Dyear%20cycles:%20the%20Indiction%2C%20Solar%2C%20and%20Lunar%20cycles) and thus are akin to [eda](#eda){.tool data-bs-toggle="tooltip" data-bs-title="epochal day aggregates"}. We can produce a Zone [5]{.color5} [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} from a [Julian date](https://en.wikipedia.org/wiki/Julian_day#:~:text=the%20Julian%20day%20number%20plus%20the%20fraction%20of%20a%20day%20since%20the%20preceding%20noon) simply by keeping the remainder after dividing by one. If we want a Zone [0]{.color0} [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} instead, we should add [5]{.color5} [decidays]{.tool data-bs-toggle="tooltip" data-bs-title="tenths of a day"} to the Julian date, divide the sum by one, and then keep the remainder as in @eq-juliantod below.
::: {.equationgroup #equationgroup03}
$$\text{tod} = (\text{julian} + 0.5) \bmod 1$$ {#eq-juliantod}
:::
# Hour minute second (hms) {#sec-hms .hiddenheading}
We can also obtain a Zone [0]{.color0} [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} from a [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time#:~:text=the%20primary%20time%20standard%20globally%20used%20to%20regulate%20clocks%20and%20time) ([UTC](#utc){#coordinateduniversaltime .tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"}) [hms](#hms){.tool data-bs-toggle="tooltip" data-bs-title="hour minute second"} triplet by summing its components after converting them to fractional days, as shown in the equation below. The [computer programming](https://en.wikipedia.org/wiki/Computer_programming#:~:text=the%20composition%20of%20sequences%20of%20instructions%2C%20called%20programs%2C%20that%20computers%20can%20follow%20to%20perform%20tasks) code in the [tabset panel](https://quarto.org/docs/interactive/layout.html#tabset-panel) beneath the equation compares [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="times of day"} derived from [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} and UNIX time as Quarto was [rendering](https://quarto.org/docs/get-started/hello/rstudio.html#rendering:~:text=When%20rendering%2C%20Quarto%20generates%20a%20new%20file%20that%20contains%20selected%20text%2C%20code%2C%20and%20results) this webpage.
::: {.equationgroup #equationgroup04}
$$\text{tod} = \dfrac{\text{hour}}{24} + \dfrac{\text{minute}}{1440} + \dfrac{\text{second}}{86400}$$ {#eq-hmstod}
:::
:::{.panel-tabset group="language"}
### Julia
```{julia}
using Dates
hms = now(UTC)
hour(hms) / 24 +
minute(hms) / 1440 +
second(hms) / 86400 +
millisecond(hms) / 864e5
datetime2unix(hms) / 86400 % 1
```
### Observable JavaScript
```{ojs}
hms = new Date();
hms.getUTCHours() / 24 +
hms.getUTCMinutes() / 1440 +
hms.getUTCSeconds() / 86400 +
hms.getUTCMilliseconds() / 864e5;
hms.getTime() / 864e5 % 1;
```
### Python
```{python}
from datetime import datetime, timezone
hms = datetime.now(timezone.utc)
hms.hour / 24 + \
hms.minute / 1440 + \
hms.second / 86400 + \
hms.microsecond / 864e8
hms.timestamp() / 86400 % 1
```
### R
```{r}
hms <- as.POSIXlt(Sys.time(), tz = "UTC")
hms$hour / 24 +
hms$min / 1440 +
hms$sec / 86400
(as.numeric(as.POSIXct(hms)) / 86400) %% 1
```
:::
Equations -@eq-dsa to -@eq-som below convert UNIX time or a Zone [0]{.color0} [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} into the three components of an [hms](#hms){.tool data-bs-toggle="tooltip" data-bs-title="hour minute second"} triplet: the "hour of day" ([hod](#hod){#hourofday .tool data-bs-toggle="tooltip" data-bs-title="hour of day"}), "minute of hour" ([moh](#moh){#minuteofhour .tool data-bs-toggle="tooltip" data-bs-title="minute of hour"}), and "second of minute" ([som](#som){#secondofminute .tool data-bs-toggle="tooltip" data-bs-title="second of minute"}), using a "daily second aggregate" ([dsa](#dsa){#dailysecondaggregate .tool data-bs-toggle="tooltip" data-bs-title="daily second aggregate"}) and "hourly second aggregate" ([hsa](#hsa){#hourlysecondaggregate .tool data-bs-toggle="tooltip" data-bs-title="hourly second aggregate"}). While both count seconds, [dsa](#dsa){.tool data-bs-toggle="tooltip" data-bs-title="daily second aggregates"} start at midnight ([Tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} [0]{.color0}) and [hsa](#hsa){.tool data-bs-toggle="tooltip" data-bs-title="hourly second aggregates"} begin at the [top of the hour](https://en.wiktionary.org/wiki/top_of_the_hour).
::: {.equationgroup #equationgroup05}
$$\begin{split}
\text{dsa} & = \text{tod} \ast 86400 \\
& = \text{unix} \bmod 86400
\end{split}
$$ {#eq-dsa}
$$
\text{hsa} = \text{dsa} \bmod 3600
$$ {#eq-hsa}
$$
\text{hod} = \lfloor \text{dsa} \div 3600 \rfloor
$$ {#eq-hod}
$$
\text{moh} = \lfloor \text{hsa} \div 60 \rfloor
$$ {#eq-moh}
$$
\text{som} = \lfloor \text{hsa} \bmod 60 \rfloor
$$ {#eq-som}
:::
:::{.panel-tabset group="language"}
### Julia
```{julia}
using Dates
dsa = datetime2unix(now(UTC)) / 86400 % 1 * 86400
hsa = dsa % 3600
map(x -> floor(Int, x), (dsa / 3600, hsa / 60, hsa % 60))
```
### Observable JavaScript
```{ojs}
dsa = Date.now() / 864e5 % 1 * 86400;
hsa = dsa % 3600;
[dsa / 3600, hsa / 60, hsa % 60].map(Math.floor)
```
### Python
```{python}
from datetime import datetime, timezone
dsa = datetime.now(timezone.utc).timestamp() / 86400 % 1 * 86400
hsa = dsa % 3600
tuple(map(int, [dsa // 3600, hsa // 60, hsa % 60 // 1]))
```
### R
```{r}
dsa <- (as.numeric(as.POSIXct(Sys.time())) / 86400) %% 1 * 86400
hsa <- dsa %% 3600
sapply(c(dsa %/% 3600, hsa %/% 60, hsa %% 60), as.integer)
```
:::
# Universal time offset (uto) {#sec-uto .hiddenheading}
The [Global Positioning System](https://en.wikipedia.org/wiki/Global_Positioning_System#:~:text=a%20satellite%2Dbased%20hyperbolic%20navigation%20system), [BeiDou](https://en.wikipedia.org/wiki/BeiDou#:~:text=a%20satellite%2Dbased%20radio%20navigation%20system), and [Galileo](https://en.wikipedia.org/wiki/Galileo_(satellite_navigation)#:~:text=a%20global%20navigation%20satellite%20system%20(GNSS)%20created%20by%20the%20European%20Union) [global navigation satellite systems](https://en.wikipedia.org/wiki/Satellite_navigation#:~:text=a%20satellite%20navigation%20system%20with%20global%20coverage) along with most --- if not all --- [programming languages](https://en.wikipedia.org/wiki/Programming_language#:~:text=a%20system%20of%20notation%20for%20writing%20source%20code%20such%20as%20used%20to%20produce%20a%20computer%20program) do not account for [leap seconds](https://en.wikipedia.org/wiki/Leap_second#:~:text=one%2Dsecond%20adjustment), which appears to be for the best given that leap seconds [can cause problems](https://www.nist.gov/pml/time-and-frequency-division/leap-seconds-faqs#:~:text=detriments%20to%20adding%20leap%20seconds) and will be abolished no later than [2027]{.color27by100}+[081]{.color081by366} according to the [International Bureau of Weights and Measures](https://en.wikipedia.org/wiki/International_Bureau_of_Weights_and_Measures#:~:text=an%20intergovernmental%20organisation%20(IGO)%2C%20through%20which%20its%2067%20member%2Dstates%20act%20on%20measurement%20standards).
On or before the deadline to abolish leap seconds, the tolerance for disagreement between [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} and [Universal Time](https://en.wikipedia.org/wiki/Universal_Time#Versions:~:text=a%20time%20standard%20based%20on%20Earth%27s%20rotation) ([UT](#ut){#universaltime .tool data-bs-toggle="tooltip" data-bs-title="Universal Time"}) will increase from [1 Dec second](https://en.wikipedia.org/wiki/Leap_second#:~:text=to%20ensure%20that%20the%20difference%20between%20the%20UTC%20and%20UT1%20readings%20will%20never%20exceed%200.9%20seconds) ([s](#s){#second .tool data-bs-toggle="tooltip" data-bs-title="Dec seconds"}) to 3750 [s](#s){.tool data-bs-toggle="tooltip" data-bs-title="Dec seconds"}. Since [1972]{.color72by100}+[122]{.color122by365}, only [27](https://en.wikipedia.org/wiki/Leap_second#:~:text=27%20leap%20seconds%20have%20been%20added%20to%20UTC) leap seconds have been inserted, which is 0.75% of 3750 [s](#s){.tool data-bs-toggle="tooltip" data-bs-title="Dec seconds"}, and at this rate it will take over five millennia for the disparity between [UT](#ut){.tool data-bs-toggle="tooltip" data-bs-title="Universal Time"} and [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} to reach 3750 [s](#s){.tool data-bs-toggle="tooltip" data-bs-title="Dec seconds"}.
Instead of leap seconds, Dec matches [UT](#ut){.tool data-bs-toggle="tooltip" data-bs-title="Universal Time"} using a "[universal time](https://en.wikipedia.org/wiki/Universal_Time#:~:text=a%20time%20standard%20based%20on%20Earth%27s%20rotation) [offset](https://en.wikipedia.org/wiki/UTC_offset#:~:text=the%20difference%20in%20hours%20and%20minutes%20between%20Coordinated%20Universal%20Time%20(UTC)%20and%20the%20standard%20time%20at%20a%20particular%20place)" ([uto](#uto){#universaltimeoffset .tool data-bs-toggle="tooltip" data-bs-title="universal time offset"}). With the [leap second insertion dates](https://en.wikipedia.org/wiki/Leap_second#:~:text=Announced%20leap%20seconds%20to%20date) provided by the [International Earth Rotation and Reference Systems Service](https://en.wikipedia.org/wiki/International_Earth_Rotation_and_Reference_Systems_Service#:~:text=the%20body%20responsible%20for%20maintaining%20global%20time%20and%20reference%20frame%20standards), we can approximate the [uto](#uto){.tool data-bs-toggle="tooltip" data-bs-title="universal time offset"} that yields [UT](#ut){.tool data-bs-toggle="tooltip" data-bs-title="Universal Time"} when added to the Zone [0]{.color0} [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} on the [Dec date](/dec/date) chosen by the [range](https://observablehq.com/framework/inputs/range)🎚️inputs below: \${leapCountHsl} ÷ 8640 = \${leapSdecHsl()}\${leapSb24hsl()} ÷ 90000 = \${leapTzoHsl()}.
```{ojs}
//| echo: false
//| label: dateinput
//| class: slider
viewof leapSecondYear = Inputs.range([1970, 2020], {label: "Year", value: 1995, step: 1})
viewof leapSecondDate = Inputs.range([0, 365], {label: "Day", value: 182, step: 1})
```
# Second interval difference (sid) {#sec-sid .hiddenheading}
The equation above divides leap seconds by the number of [International System of Units](https://en.wikipedia.org/wiki/International_System_of_Units#:~:text=the%20world%27s%20most%20widely%20used%20system%20of%20measurement) ([SI](#si){#internationalsystemofunits .tool data-bs-toggle="tooltip" data-bs-title="International System of Units"}) seconds ([sis](#sis){#sisecond .tool data-bs-toggle="tooltip" data-bs-title="SI seconds"}) or Dec [deciseconds]{.tool data-bs-toggle="tooltip" data-bs-title="tenths of a second"} ([ds](#ds){#decisecond .tool data-bs-toggle="tooltip" data-bs-title="Dec deciseconds"}) in a [deciday]{.tool data-bs-toggle="tooltip" data-bs-title="tenth of a day"} ([dd](#dd){#deciday .tool data-bs-toggle="tooltip" data-bs-title="deciday"}): 8640 [sis](#sis){.tool data-bs-toggle="tooltip" data-bs-title="SI seconds"} = 90000 [ds](#ds){.tool data-bs-toggle="tooltip" data-bs-title="Dec deciseconds"} = 1 [dd](#dd){.tool data-bs-toggle="tooltip" data-bs-title="deciday"}. To avoid [repeating decimals](https://en.wikipedia.org/wiki/Repeating_decimal#:~:text=the%20same%20sequence%20of%20digits%20is%20repeated%20forever) when turning [sis](#sis){.tool data-bs-toggle="tooltip" data-bs-title="SI seconds"} into [ds](#ds){.tool data-bs-toggle="tooltip" data-bs-title="Dec deciseconds"}, we can put a Dec [quadravigesimal](https://en.wikipedia.org/wiki/List_of_numeral_systems#:~:text=24-,Quadravigesimal,-%5B48%5D) ([base24]{.tool data-bs-toggle="tooltip" data-bs-title="quadravigesimal"}) digit in place of the ones digit and decimal part of the [ds](#ds){.tool data-bs-toggle="tooltip" data-bs-title="Dec deciseconds"}: \${leapSdecHsl()}\${leapSb24hsl()} = \${leapSdecHsl()} × 10 + \${leapSsidHsl} ÷ 2.4.
Known as a "second interval difference" ([sid](#sid){#secondintervaldifference .tool data-bs-toggle="tooltip" data-bs-title="second interval difference"}), the [base24]{.tool data-bs-toggle="tooltip" data-bs-title="quadravigesimal"} ([b24](#b24){#base24 .tool data-bs-toggle="tooltip" data-bs-title="base24"}) character at the end of \${leapSdecHsl()}\${leapSb24hsl()} is a letter of the [Greek alphabet](https://en.wikipedia.org/wiki/Greek_alphabet#:~:text=the%20writing%20system%20used%20for%20the%20Greek%20language). To display [sis](#sis){.tool data-bs-toggle="tooltip" data-bs-title="SI seconds"} in [ds](#ds){.tool data-bs-toggle="tooltip" data-bs-title="Dec deciseconds"}, we can concatenate the integer part of the [s](#s){.tool data-bs-toggle="tooltip" data-bs-title="Dec seconds"} we obtain from @eq-sis with the [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} representation of the [sid](#sid){.tool data-bs-toggle="tooltip" data-bs-title="second interval difference"} we get from @eq-sid. The table beneath these equations lists [base10](https://en.wikipedia.org/wiki/Decimal#:~:text=a%20numeral%20system%20that%20uses%20ten%20as%20its%20radix%20%28base%29) ([b10](#b10){#base10 .tool data-bs-toggle="tooltip" data-bs-title="base10"}) and [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} equivalents.
::: {.equationgroup #equationgroup06}
$$
\text{s} = \dfrac{\text{ds}}{10} = \dfrac{\text{sis}}{0.96}
$$ {#eq-sis}
$$
\begin{split}
\text{sid} &= \text{sis} \bmod 24\\
&= (\text{s} - \text{sis}) \ast 24 \bmod 24
\end{split}
$$ {#eq-sid}
:::
## Base24 {#sec-b24 .unnumbered .hiddenheading}
::::: {#tbl-b24 .overflowtable}
::: {.d-none .d-lg-block}
| [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} | [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} | [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} | [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} | [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} | [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} | [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} | [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} |
| --- | --- | --- | --- | --- | --- | --- | --- |
| [0]{.color0 .mono} | [α]{.color0 .mono} | [6]{.color6by24 .mono} | [η]{.color6by24 .mono} | [12]{.color12by24 .mono} | [ν]{.color12by24 .mono} | [18]{.color18by24 .mono} | [τ]{.color18by24 .mono} |
| [1]{.color1by24 .mono} | [β]{.color1by24 .mono} | [7]{.color7by24 .mono} | [θ]{.color7by24 .mono} | [13]{.color13by24 .mono} | [ξ]{.color13by24 .mono} | [19]{.color19by24 .mono} | [υ]{.color19by24 .mono} |
| [2]{.color2by24 .mono} | [γ]{.color2by24 .mono} | [8]{.color8by24 .mono} | [ι]{.color8by24 .mono} | [14]{.color14by24 .mono} | [ο]{.color14by24 .mono} | [20]{.color20by24 .mono} | [φ]{.color20by24 .mono} |
| [3]{.color3by24 .mono} | [δ]{.color3by24 .mono} | [9]{.color9by24 .mono} | [κ]{.color9by24 .mono} | [15]{.color15by24 .mono} | [π]{.color15by24 .mono} | [21]{.color21by24 .mono} | [χ]{.color21by24 .mono} |
| [4]{.color4by24 .mono} | [ε]{.color4by24 .mono} | [10]{.color10by24 .mono} | [λ]{.color10by24 .mono} | [16]{.color16by24 .mono} | [ρ]{.color16by24 .mono} | [22]{.color22by24 .mono} | [ψ]{.color22by24 .mono} |
| [5]{.color5by24 .mono} | [ζ]{.color5by24 .mono} | [11]{.color11by24 .mono} | [μ]{.color11by24 .mono} | [17]{.color17by24 .mono} | [σ]{.color17by24 .mono} | [23]{.color23by24 .mono} | [ω]{.color23by24 .mono} |
:::
::: {.d-none .d-md-block .d-lg-none}
| [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} | [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} | [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} | [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} |
| --- | --- | --- | --- |
| [0]{.color0 .mono} | [α]{.color0 .mono} | [12]{.color12by24 .mono} | [ν]{.color12by24 .mono} |
| [1]{.color1by24 .mono} | [β]{.color1by24 .mono} | [13]{.color13by24 .mono} | [ξ]{.color13by24 .mono} |
| [2]{.color2by24 .mono} | [γ]{.color2by24 .mono} | [14]{.color14by24 .mono} | [ο]{.color14by24 .mono} |
| [3]{.color3by24 .mono} | [δ]{.color3by24 .mono} | [15]{.color15by24 .mono} | [π]{.color15by24 .mono} |
| [4]{.color4by24 .mono} | [ε]{.color4by24 .mono} | [16]{.color16by24 .mono} | [ρ]{.color16by24 .mono} |
| [5]{.color5by24 .mono} | [ζ]{.color5by24 .mono} | [17]{.color17by24 .mono} | [σ]{.color17by24 .mono} |
| [6]{.color6by24 .mono} | [η]{.color6by24 .mono} | [18]{.color18by24 .mono} | [τ]{.color18by24 .mono} |
| [7]{.color7by24 .mono} | [θ]{.color7by24 .mono} | [19]{.color19by24 .mono} | [υ]{.color19by24 .mono} |
| [8]{.color8by24 .mono} | [ι]{.color8by24 .mono} | [20]{.color20by24 .mono} | [φ]{.color20by24 .mono} |
| [9]{.color9by24 .mono} | [κ]{.color9by24 .mono} | [21]{.color21by24 .mono} | [χ]{.color21by24 .mono} |
| [10]{.color10by24 .mono} | [λ]{.color10by24 .mono} | [22]{.color22by24 .mono} | [ψ]{.color22by24 .mono} |
| [11]{.color11by24 .mono} | [μ]{.color11by24 .mono} | [23]{.color23by24 .mono} | [ω]{.color23by24 .mono} |
:::
::: {.d-md-none}
| [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} | [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} |
| --- | --- |
| [0]{.color0 .mono} | [α]{.color0 .mono} |
| [1]{.color1by24 .mono} | [β]{.color1by24 .mono} |
| [2]{.color2by24 .mono} | [γ]{.color2by24 .mono} |
| [3]{.color3by24 .mono} | [δ]{.color3by24 .mono} |
| [4]{.color4by24 .mono} | [ε]{.color4by24 .mono} |
| [5]{.color5by24 .mono} | [ζ]{.color5by24 .mono} |
| [6]{.color6by24 .mono} | [η]{.color6by24 .mono} |
| [7]{.color7by24 .mono} | [θ]{.color7by24 .mono} |
| [8]{.color8by24 .mono} | [ι]{.color8by24 .mono} |
| [9]{.color9by24 .mono} | [κ]{.color9by24 .mono} |
| [10]{.color10by24 .mono} | [λ]{.color10by24 .mono} |
| [11]{.color11by24 .mono} | [μ]{.color11by24 .mono} |
| [12]{.color12by24 .mono} | [ν]{.color12by24 .mono} |
| [13]{.color13by24 .mono} | [ξ]{.color13by24 .mono} |
| [14]{.color14by24 .mono} | [ο]{.color14by24 .mono} |
| [15]{.color15by24 .mono} | [π]{.color15by24 .mono} |
| [16]{.color16by24 .mono} | [ρ]{.color16by24 .mono} |
| [17]{.color17by24 .mono} | [σ]{.color17by24 .mono} |
| [18]{.color18by24 .mono} | [τ]{.color18by24 .mono} |
| [19]{.color19by24 .mono} | [υ]{.color19by24 .mono} |
| [20]{.color20by24 .mono} | [φ]{.color20by24 .mono} |
| [21]{.color21by24 .mono} | [χ]{.color21by24 .mono} |
| [22]{.color22by24 .mono} | [ψ]{.color22by24 .mono} |
| [23]{.color23by24 .mono} | [ω]{.color23by24 .mono} |
:::
:::::
## Base9 {#sec-b9 .unnumbered .hiddenheading}
Whereas [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} is like glue that allows us to combine [s](#s){.tool data-bs-toggle="tooltip" data-bs-title="Dec seconds"} and [sid](#sid){.tool data-bs-toggle="tooltip" data-bs-title="second interval differences"}, Dec [nonary](https://en.wikipedia.org/wiki/Ternary_numeral_system#Compact_ternary_representation:_base_9_and_27:~:text=base%209%2C%20each%20digit%20is%20two%20ternary%20digits) ([base9]{.tool data-bs-toggle="tooltip" data-bs-title="nonary"}) enables us to append [s](#s){.tool data-bs-toggle="tooltip" data-bs-title="Dec seconds"} to a [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"}. The table below shows the [astronomical symbols](https://en.wikipedia.org/wiki/Astronomical_symbol#:~:text=symbols%20used%20to%20represent%20astronomical%20objects) used by Dec for [base9]{.tool data-bs-toggle="tooltip" data-bs-title="nonary"} ([b9](#b9){#base9 .tool data-bs-toggle="tooltip" data-bs-title="base9"}). When we replace the "decimilliday" ([dmd](#dmd){#decimilliday .tool data-bs-toggle="tooltip" data-bs-title="decimilliday"}) digit in a [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} with a [b9](#b9){.tool data-bs-toggle="tooltip" data-bs-title="base9"} digit, the [b9](#b9){.tool data-bs-toggle="tooltip" data-bs-title="base9"} digit counts tens of [s](#s){.tool data-bs-toggle="tooltip" data-bs-title="Dec seconds"} instead of [dmd](#dmd){.tool data-bs-toggle="tooltip" data-bs-title="decimilliday"} and the next digit tracks [s](#s){.tool data-bs-toggle="tooltip" data-bs-title="Dec seconds"} instead of "centimillidays" ([cmd](#cmd){#centimilliday .tool data-bs-toggle="tooltip" data-bs-title="centimillidays"}).
::::: {#tbl-b9 .overflowtable}
::: {.d-none .d-md-block}
| [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} | [b9](#b9){.tool data-bs-toggle="tooltip" data-bs-title="base9"} | [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} | [b9](#b9){.tool data-bs-toggle="tooltip" data-bs-title="base9"} | [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} | [b9](#b9){.tool data-bs-toggle="tooltip" data-bs-title="base9"} |
| --- | --- | --- | --- | --- | --- |
| [0]{.color0} | [☉]{.color0 .mono} | [3]{.color3by9} | [♁]{.color3by9 .mono} | [6]{.color6by9} | [♄]{.color6by9 .mono} |
| [1]{.color1by9} | [☿]{.color1by9 .mono} | [4]{.color4by9} | [♂]{.color4by9 .mono} | [7]{.color7by9} | [♅]{.color7by9 .mono} |
| [2]{.color2by9} | [♀]{.color2by9 .mono} | [5]{.color5by9} | [♃]{.color5by9 .mono} | [8]{.color8by9} | [♆]{.color8by9 .mono} |
:::
::: {.d-md-none}
| [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} | [b9](#b9){.tool data-bs-toggle="tooltip" data-bs-title="base9"} |
| --- | --- |
| [0]{.color0} | [☉]{.color0 .mono} |
| [1]{.color1by9} | [☿]{.color1by9 .mono} |
| [2]{.color2by9} | [♀]{.color2by9 .mono} |
| [3]{.color3by9} | [♁]{.color3by9 .mono} |
| [4]{.color4by9} | [♂]{.color4by9 .mono} |
| [5]{.color5by9} | [♃]{.color5by9 .mono} |
| [6]{.color6by9} | [♄]{.color6by9 .mono} |
| [7]{.color7by9} | [♅]{.color7by9 .mono} |
| [8]{.color8by9} | [♆]{.color8by9 .mono} |
:::
:::::
A [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} with four [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} digits, one [b9](#b9){.tool data-bs-toggle="tooltip" data-bs-title="base9"}, and one [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} digit can match the time represented by any [hms](#hms){.tool data-bs-toggle="tooltip" data-bs-title="hour minute second"} triplet, because the product of the bases of its digits is evenly divisible by the number of [sis](#sis){.tool data-bs-toggle="tooltip" data-bs-title="SI seconds"} in a day: 10000 × 9 × 24 ÷ 86400 = 216000 ÷ 86400 = 25. For [hod](#hod){.tool data-bs-toggle="tooltip" data-bs-title="hour of day"}, one [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} digit is sufficient. The [hms](#hms){.tool data-bs-toggle="tooltip" data-bs-title="hour minute second"} triplet selected by the range inputs below corresponds to [Hod](#hod){.tool data-bs-toggle="tooltip" data-bs-title="hour of day"} \${b24hodHsl} and [Tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} \${hmsTodHsl}\${hmsSecHsl}\${hmsSidHsl}.
```{ojs}
//| echo: false
//| label: hmsinput
//| class: slider
viewof hmsinput = Inputs.form([
Inputs.range([0, 23], {label: "Hour", value: 11, step: 1}),
Inputs.range([0, 59], {label: "Minute", value: 0, step: 1}),
Inputs.range([0, 59], {label: "Second", value: 0, step: 1}),
])
```
In @tbl-time below, the [quotidie]{.tool data-bs-toggle="tooltip" data-bs-title="per day"} ([q](#q){#quotidie .tool data-bs-toggle="tooltip" data-bs-title="quotidie"}) column shows how many multiples of the unit in each row can fit into one day and the [md](#md){.tool data-bs-toggle="tooltip" data-bs-title="millidays"} column uses endings called Dec terminators to transform the fraction of a day that each unit represents from a repeating decimal into a [terminating decimal](https://en.wikipedia.org/wiki/Repeating_decimal#:~:text=a%20finite%20number%20of%20nonzero%20digits). The [b9](#b9){.tool data-bs-toggle="tooltip" data-bs-title="base9"} digit in the terminators in @tbl-time represents 6 [decaseconds]{.tool data-bs-toggle="tooltip" data-bs-title="tens of seconds"} ([Ds](#decasec){#decasecond .tool data-bs-toggle="tooltip" data-bs-title="tens of seconds"}): 6 ÷ 9 = 0.[♄]{.color6by9 .mono}.
::: {#tbl-time .unittable .overflowtable}
| Time units | [q](#q){.bold .tool data-bs-toggle="tooltip" data-bs-title="per day"} | [md](#md){.tool data-bs-toggle="tooltip" data-bs-title="millidays"} |
| ------------------------------------------------------------------------- | --------------------------------------------------------------------: | :------------------------------------------------------------------ |
| [hour](https://en.wikipedia.org/wiki/Hour) | [24]{.mono} | [41.[♄]{.color6by9}]{.mono} |
| [minute](https://en.wikipedia.org/wiki/Minute) | [1440]{.mono} | [ 0.[♄]{.color6by9}[η]{.color6by24}]{.mono} |
| [sis](#sis){.tool data-bs-toggle="tooltip" data-bs-title="SI seconds"} | [86400]{.mono} | [ 0.0[☿]{.color1by9}[β]{.color1by24}]{.mono} |
| [s](#s){.tool data-bs-toggle="tooltip" data-bs-title="Dec seconds"} | [90000]{.mono} | [ 0.0[☿]{.color1by9}]{.mono} |
:::
# Coordinated Universal Time (UTC) {#sec-utc .hiddenheading}
Rather than use a terminator as in @tbl-time, Dec expresses one hour in [dd](#dd){.tool data-bs-toggle="tooltip" data-bs-title="decidays"} as a single [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} digit: 0.41[♄]{.color6by9 .mono} = [β]{.color1by24 .mono}. If we add [β]{.color1by24 .mono} [dd](#dd){.tool data-bs-toggle="tooltip" data-bs-title="deciday"} to the Zone [0]{.color0} [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"}, we get the [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} associated with the [UTC+1 offset](https://en.wikipedia.org/wiki/UTC%2B01:00#:~:text=a%20time%20offset%20from%20UTC%20of%20%2B01%3A00): 0.\${zeroTpadHsl()} + [β]{.color1by24 .mono} ÷ 10 = \${utc1tintHsl()}. Currently, the Zone [0]{.color0} Dec time is \${zeroTpadHsl()}−[0]{.color0} and the UTC+1 Dec time is \${utc1tpadHsl()}−[β]{.color1by24 .mono}. Dec times consist of a [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"}, a minus sign (−), and an offset.
There are 12 [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} offsets that become a terminating decimals after being converted from hours to days and therefore could be displayed in either [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} or [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"}. Although it has only ten time zones, Dec can express any [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} offset using one or two non-negative [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} digits. There are 27 [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} offsets that require only one [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} digit and 11 that need two [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} digits.
Out of the [38](https://en.wikipedia.org/wiki/List_of_UTC_offsets) [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} offsets, 14 are negative (<[UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"}) and 24 are non-negative (≥[UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"}). The [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} time zone with [the most negative offset](https://en.wikipedia.org/wiki/UTC%E2%88%9212:00#:~:text=a%20nautical%20time%20zone%20comprising%20the%20high%20seas%20between%20180%C2%B0%20and%20172%C2%B030%E2%80%B2W%20longitude) is completely uninhabited. The bar chart below visualizes the population of each [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} time zone based on 2020 [Socioeconomic Data and Applications Center](https://www.earthdata.nasa.gov/centers/sedac-daac) data. The vast majority of all people live in [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} time zones with ≥[UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} offsets.
{{< include /dec/time/_tzpopplot.qmd >}}
Negative [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} offsets only exist in [the Americas](https://en.wikipedia.org/wiki/Americas#:~:text=a%20landmass%20comprising%20the%20totality%20of%20North%20America%20and%20South%20America) and islands in the [Atlantic](https://en.wikipedia.org/wiki/List_of_islands_in_the_Atlantic_Ocean) and [Pacific](https://en.wikipedia.org/wiki/List_of_islands_in_the_Pacific_Ocean) Oceans. Therefore, the bar chart above is essentially comparing the populations of the Americas and the rest of the world. According to 2021 [United Nations Department of Economic and Social Affairs](https://en.wikipedia.org/wiki/United_Nations_Department_of_Economic_and_Social_Affairs#:~:text=part%20of%20the%20United%20Nations%20Secretariat) data, roughly 1 billion out of a total of almost 8 billion people live in the Americas.
Dec forbids the association of dates with negative offsets. Therefore, Dec will add ten [decidays]{.tool data-bs-toggle="tooltip" data-bs-title="tenths of a day"} to any negative offset and add one day to the date associated with that offset. Negative offset handling has no effect on the [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} or the conversion of an [hms](#hms){.tool data-bs-toggle="tooltip" data-bs-title="hour minute second"} triplet to a [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} and is typically only necessary after a "year month day" ([ymd](#ymd){#yearmonthday .tool data-bs-toggle="tooltip" data-bs-title="year month day"}) triplet is converted into a Dec date.
If we do know whether Day [364]{.color364by365} belongs to a common or leap year, adding one day to it yields either Day [0]{.color0} or Day [365]{.color365by366} and this uncertainty is expressed as a [multiplication sign](https://en.wikipedia.org/wiki/Multiplication_sign) over the last digit of [36[5]{.acutegrave}]{.color0}. The sign hints that [36[5]{.acutegrave}]{.color0} is short for [365]{.color0}×`leap`, where [36[5]{.acutegrave}]{.color0} is either [365]{.color365by366} if `leap` is 1 or [0]{.color0} if `leap` is 0. We can find `leap` by passing any year ([y](#y){#year .tool data-bs-toggle="tooltip" data-bs-title="year"}) to @eq-leap below.
::: {.equationgroup #equationgroup07}
$$
\text{leap}=\begin{cases}
1&{\begin{aligned}
&\text{ if } (\text{y} + 1)\href{https://en.wikipedia.org/wiki/Modulo#:~:text=returns%20the%20remainder%20or%20signed%20remainder%20of%20a%20division}{\bmod} \ \ \ \ 4=0\\
&\href{https://en.wikipedia.org/wiki/Logical_conjunction}{\land}(\text{y} + 1)\href{https://en.wikipedia.org/wiki/Modulo#:~:text=returns%20the%20remainder%20or%20signed%20remainder%20of%20a%20division}{\bmod} 100\neq0\\
&\href{https://en.wikipedia.org/wiki/Logical_disjunction}{\lor}(\text{y} + 1)\href{https://en.wikipedia.org/wiki/Modulo#:~:text=returns%20the%20remainder%20or%20signed%20remainder%20of%20a%20division}{\bmod} 400=0\end{aligned}}\\\\
0&{\text{ otherwise}}\end{cases}
$$ {#eq-leap}
:::
# Day of week (dow) {#sec-dow .hiddenheading}
Adding one day to the [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="day of year"} has no effect on the [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"}, but it increments the [dom](#dom){.tool data-bs-toggle="tooltip" data-bs-title="day of month"} and "day of week" ([dow](#dow){#dayofweek .tool data-bs-toggle="tooltip" data-bs-title="day of week"}). Dec meets the expectations of [Gregorian calendar](https://en.wikipedia.org/wiki/Gregorian_calendar#:~:text=the%20calendar%20currently%20used%20in%20most%20parts%20of%20the%20world) users who live in [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} time zones with negative offsets by essentially deriving the previous [dom](#dom){.tool data-bs-toggle="tooltip" data-bs-title="days of month"} or [dow](#dow){.tool data-bs-toggle="tooltip" data-bs-title="days of week"} from the current [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="day of year"} if a location in the Americas is provided without an offset or with a negative offset.
# Time zone offset (tzo) {#sec-tzo .hiddenheading}
In Dec, "time zone offsets" ([tzo](#tzo){#timezoneoffset .tool data-bs-toggle="tooltip" data-bs-title="time zone offsets"}) are derived solely from longitude. Dec measures [longitude](https://en.wikipedia.org/wiki/Longitude#:~:text=denoted%20by%20the%20Greek%20letter%20lambda) in [wěi](https://en.wiktionary.org/wiki/%E7%B7%AF#:~:text=(geography)-,latitude,-coordinate%20terms%C2%A0%E2%96%B2) ([w](#w){#wei .tool data-bs-toggle="tooltip" data-bs-title="horizontal lines on a map"}), arcbeats ([a](#a){#arcbeat .tool data-bs-toggle="tooltip" data-bs-title="arcbeats"}), or submultiples thereof. If we travel East or West until we reach our starting point, we will cover 1 [w](#w){.tool data-bs-toggle="tooltip" data-bs-title="horizontal line on a map"} or 100000 ([10^5^]{.tool data-bs-toggle="tooltip" data-bs-title="one hundred thousand"}) [a](#a){.tool data-bs-toggle="tooltip" data-bs-title="arcbeats"}. A [tzo](#tzo){.tool data-bs-toggle="tooltip" data-bs-title="time zone offsets"} is essentially a [deciwěi]{.tool data-bs-toggle="tooltip" data-bs-title="tenth of a wěi"} ([dw](#dw){#deciwei .tool data-bs-toggle="tooltip" data-bs-title="deciwěi"}) longitude that became a single-digit [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} integer via [truncation](https://en.wikipedia.org/wiki/Truncation#Truncation_and_floor_function:~:text=truncation%20is%20limiting%20the%20number%20of%20digits%20right%20of%20the%20decimal%20point) or [flooring](https://en.wikipedia.org/wiki/Floor_and_ceiling_functions#:~:text=takes%20as%20input%20a%20real%20number%20x%2C%20and%20gives%20as%20output%20the%20greatest%20integer%20less%20than%20or%20equal%20to%20x): ⌊\${longInputHsl} ÷ 100⌋ = \${longFloorHsl}.
```{ojs}
//| echo: false
//| label: loninput
//| class: slider
viewof lonInput = Inputs.range([0, 999], {label: "Milliwěi", value: 500, step: 1})
```
The [Equator](https://en.wikipedia.org/wiki/Equator#:~:text=the%20circle%20of%20latitude%20that%20divides%20Earth%20into%20the%20Northern%20and%20Southern%20Hemispheres) is approximately ([~]{.tool data-bs-toggle="tooltip" data-bs-title="approximately"}) 1 [taur]{.tool data-bs-toggle="tooltip" data-bs-title="circumference = 𝜏r"} ([c](#c){#taur .tool data-bs-toggle="tooltip" data-bs-title="taur"}) or [~]{.tool data-bs-toggle="tooltip" data-bs-title="approximately"}[10^5^]{.tool data-bs-toggle="tooltip" data-bs-title="one hundred thousand"} [kilozem]{.tool data-bs-toggle="tooltip" data-bs-title="thousands of zone equatorial meters"} ([kz](#kz){#kilozem .tool data-bs-toggle="tooltip" data-bs-title="thousands of zone equatorial meters"}) long. Near the Equator, a longitude that has a [precision](https://en.wikipedia.org/wiki/Decimal_degrees#Precision) of 0.1 [microwěi]{.tool data-bs-toggle="tooltip" data-bs-title="millionths of wěi"} ([µw](#uw){#microwei .tool data-bs-toggle="tooltip" data-bs-title="microwěi"}) or 10 milliarcbeats ([ma](#ma){#milliarcbeats .tool data-bs-toggle="tooltip" data-bs-title="milliarcbeats"}) is accurate to within [~]{.tool data-bs-toggle="tooltip" data-bs-title="approximately"}0.1 [microtaur]{.tool data-bs-toggle="tooltip" data-bs-title="millionths of taur"} ([µc](#uc){#microtaur .tool data-bs-toggle="tooltip" data-bs-title="microtaur"}), [~]{.tool data-bs-toggle="tooltip" data-bs-title="approximately"}10 "zone equatorial meters" ([zem]{.tool data-bs-toggle="tooltip" data-bs-title="zone equatorial meters"}), or 4 [meters](https://en.wikipedia.org/wiki/Metre#Definition:~:text=the%20base%20unit%20of%20length%20in%20the%20International%20System%20of%20Units), which is about the width of a [U-shaped living room layout](https://www.dimensions.com/collection/living-room-layouts) or the length of a typical [subcompact car](https://www.dimensions.com/collection/subcompact-cars-b-segment).
For precise [geopositioning](https://en.wikipedia.org/wiki/Geopositioning#:~:text=estimating%20the%20geographic%20position%20of%20an%20object%20or%20a%20person), we may want to express [geographic coordinates](https://en.wikipedia.org/wiki/Geographic_coordinate_system#:~:text=for%20measuring%20and%20communicating%20positions%20directly%20on%20Earth%20as%20latitude%20and%20longitude) in [ma](#ma){.tool data-bs-toggle="tooltip" data-bs-title="milliarcbeats"}, but we are unlikely to need [s](#s){.tool data-bs-toggle="tooltip" data-bs-title="Dec seconds"} or [cmd](#cmd){.tool data-bs-toggle="tooltip" data-bs-title="centimillidays"} when displaying the [solar time](https://en.wikipedia.org/wiki/Solar_time#:~:text=a%20calculation%20of%20the%20passage%20of%20time%20based%20on%20the%20position%20of%20the%20Sun%20in%20the%20sky) or estimates of what the [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} will be when the Sun rises, reaches its [highest point of the day](https://en.m.wikipedia.org/wiki/Noon#:~:text=highest%20position%20above%20the%20horizon), or sets. By default, Dec uses [md](#md){.tool data-bs-toggle="tooltip" data-bs-title="millidays"} precision to display a solar time and the "solar time offset" ([sto](#sto){#solartimeoffset .tool data-bs-toggle="tooltip" data-bs-title="solar time offset"}) used to produce it.
# Solar time offset (sto) {#sec-sto .hiddenheading}
In Dec, any offset can be called a [sto](#sto){.tool data-bs-toggle="tooltip" data-bs-title="solar time offset"} or a [uto](#uto){.tool data-bs-toggle="tooltip" data-bs-title="universal time offset"}, because there will always be a longitude at which the sum of the given offset and the Zone [0]{.color0} [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} will yield solar time or [UT](#ut){.tool data-bs-toggle="tooltip" data-bs-title="Universal Time"}. In contrast, Dec has only ten [tzo](#tzo){.tool data-bs-toggle="tooltip" data-bs-title="time zone offsets"}, one for each of its ten time zones. Dec translates [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} to Zone [0]{.color0} and UTC−12 or UTC+12 to Zone [5]{.color5}, but does not categorize any other UTC offset as a [tzo](#tzo){.tool data-bs-toggle="tooltip" data-bs-title="time zone offset"}.
Dec permits any non-negative offset that is less than one day and can be written with a finite number of [b9](#b9){.tool data-bs-toggle="tooltip" data-bs-title="base9"}, [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"}, and [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} digits. When a [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} or an offset does not have a decimal separator, its measurement unit is a submultiple of a day equal to 10^-[til](#til){.tool data-bs-toggle="tooltip" data-bs-title="time integer length"}^ days, where [til](#til){.tool data-bs-toggle="tooltip" data-bs-title="time integer length"} is its "time integer length", its [level of precision](https://simple.wikipedia.org/wiki/Precision_(numbers)#:~:text=level%20of%20exactness%20in%20a%20number%27s%20digits), or its digit count including any [leading zeros](https://en.wikipedia.org/wiki/Leading_zero#:~:text=any%200%20digit%20that%20comes%20before%20the%20first%20nonzero%20digit).
[Stockholm](https://en.wikipedia.org/wiki/Stockholm#:~:text=the%20capital%20and%20most%20populous%20city%20of%20Sweden), the capital city of [Sweden](https://en.wikipedia.org/wiki/Sweden#:~:text=a%20Nordic%20country%20located%20on%20the%20Scandinavian%20Peninsula%20in%20Northern%20Europe)🇸🇪, is located at [~]{.tool data-bs-toggle="tooltip" data-bs-title="approximately"}[1]{.color1} [dw](#dw){.tool data-bs-toggle="tooltip" data-bs-title="deciwěi"}, almost exactly on the border between Zones [0]{.color0} and [1]{.color1}. A longitude of [1]{.color1} [dw](#dw){.tool data-bs-toggle="tooltip" data-bs-title="deciwěi"} corresponds to a [sto](#sto){.tool data-bs-toggle="tooltip" data-bs-title="solar time offset"} of [05]{.color05}. The [til](#til){.tool data-bs-toggle="tooltip" data-bs-title="time integer length"} of [05]{.color05} is 2 and therefore its measurement unit is the centiday ([cd](#cd){.tool data-bs-toggle="tooltip" data-bs-title="centiday"}), which is 10^-2^ days. We can use a multiplicative [conversion factor](https://en.wikipedia.org/wiki/Conversion_of_units#:~:text=changes%20the%20unit%20without%20changing%20the%20quantity) of 10^-2^ to convert [cd](#cd){.tool data-bs-toggle="tooltip" data-bs-title="centiday"} to [d](#d){.tool data-bs-toggle="tooltip" data-bs-title="days"}: 5 × 10^-2^ = 0.[05]{.color05}.
Outside of Dec, longitudes are often provided in [Greenwich](https://en.wikipedia.org/wiki/Prime_meridian_&28Greenwich&29#:~:text=a%20geographical%20reference%20line%20that%20passes%20through%20the%20Royal%20Observatory%2C%20Greenwich%2C%20in%20London%2C%20England) [degrees](https://en.wikipedia.org/wiki/Degree_%28angle%29#:~:text=a%20unit%20of%20measurement%20of%20a%20plane%20angle%20in%20which%20one%20full%20rotation%20is%20assigned%20the%20value%20of%20360%20degrees) ([g°](#gdeg){#greenwichdegrees .tool data-bs-toggle="tooltip" data-bs-title="Greenwich degrees"}). @eq-deg2wei converts [g°](#gdeg){.tool data-bs-toggle="tooltip" data-bs-title="Greenwich degrees"} to [w](#w){.tool data-bs-toggle="tooltip" data-bs-title="wěi"} and @eq-wei2deg does the opposite. To obtain a [sto](#sto){.tool data-bs-toggle="tooltip" data-bs-title="solar time offset"}, we can pass [w](#w){.tool data-bs-toggle="tooltip" data-bs-title="wěi"} to @eq-wei2sto or [g°](#gdeg){.tool data-bs-toggle="tooltip" data-bs-title="Greenwich degrees"} to @eq-deg2sto below. As shown in @eq-mst below, we can sum an [sto](#sto){.tool data-bs-toggle="tooltip" data-bs-title="solar time offset"} with the Zone [0]{.color0} [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} to get a yearly average of solar time called ["mean solar time"](https://en.wikipedia.org/wiki/Solar_time#Mean_solar_time:~:text=it%20follows%20an%20imaginary%20%22mean%20Sun%22%20that%20moves%20along%20the%20celestial%20equator%20at%20a%20constant%20rate%20that%20matches%20the%20real%20Sun%27s%20average%20rate%20over%20the%20year) ([mst](#mst){#meansolartime .tool data-bs-toggle="tooltip" data-bs-title="mean solar time"}).
::: {.equationgroup #equationgroup08}
$$\text{w} = (\text{g}^\circ + 378) \div 360 \bmod 1$$ {#eq-deg2wei}
$$\text{g}^\circ = (\text{w} + 0.45) \bmod 1 \times 360 - 180$$ {#eq-wei2deg}
$$\text{sto} = (0.95 + \text{w}) \bmod 1$$ {#eq-wei2sto}
$$\text{sto} = (\text{g}^\circ + 360) \div 360 \bmod 1$$ {#eq-deg2sto}
$$\text{mst} = (\text{tod} + \text{sto}) \bmod 1$$ {#eq-mst}
:::
# Equation of time (eot) {#sec-eot .hiddenheading}
If we want to tailor our solar time calculations to a specific [ada](#ada){.tool data-bs-toggle="tooltip" data-bs-title="annual day aggregate"} instead of an average for the entire year, we can calculate ["apparent solar time"](https://en.wikipedia.org/wiki/Solar_time#Apparent_solar_time:~:text=the%20apparent%20motion%20of%20the%20actual%20Sun) ([ast](#ast){#apparentsolartime .tool data-bs-toggle="tooltip" data-bs-title="apparent solar time"}) by summing [mst](#mst){.tool data-bs-toggle="tooltip" data-bs-title="mean solar time"} with the ["equation of time"](https://en.wikipedia.org/wiki/Equation_of_time#:~:text=the%20discrepancy%20between%20two%20kinds%20of%20solar%20time) ([eot](#eot){#equationoftime .tool data-bs-toggle="tooltip" data-bs-title="equation of time"}), as shown in @eq-ast.
Obtaining the [eot](#eot){.tool data-bs-toggle="tooltip" data-bs-title="equation of time"} requires a "time of year" ([toy](#toy){#timeofyear .tool data-bs-toggle="tooltip" data-bs-title="time of year"}), which is an [ada](#ada){.tool data-bs-toggle="tooltip" data-bs-title="annual day aggregate"} that was converted from days to years as displayed in @eq-toy.
::: {.equationgroup #equationgroup09}
$$\text{ast} = (0.95 + \text{tod} + \text{w} + \text{eot}) \bmod 1$$ {#eq-ast}
$$\text{toy} = \text{ada} \div \text{syl}$$ {#eq-toy}
$$\text{syl} = \text{leap} + 365$$ {#eq-syl}
:::
To obtain a [toy](#toy){.tool data-bs-toggle="tooltip" data-bs-title="time of year"}, we divide an [ada](#ada){.tool data-bs-toggle="tooltip" data-bs-title="annual day aggregate"} by a "solar year length" ([syl](#syl){#solaryearlength .tool data-bs-toggle="tooltip" data-bs-title="solar year length"}), which is the number of days in the year. Dec passes the [toy](#toy){.tool data-bs-toggle="tooltip" data-bs-title="time of year"} directly from @eq-toy to the [eot](#eot){.tool data-bs-toggle="tooltip" data-bs-title="equation of time"} function in @eq-eot without first multiplying it by 2𝜋 or 𝜏 to convert it from [turns](https://en.wikipedia.org/wiki/Turn_%28angle%29#:~:text=a%20unit%20of%20plane%20angle%20measurement%20equal%20to%202%CF%80%C2%A0radians%2C%20360%C2%A0degrees) ([t](#t){#turn .tool data-bs-toggle="tooltip" data-bs-title="turns"}) to [radians](https://en.wikipedia.org/wiki/Radian#:~:text=the%20unit%20of%20angle%20in%20the%20International%20System%20of%20Units) ([rad](#rad){#radian .tool data-bs-toggle="tooltip" data-bs-title="radians"}) because the [sin](https://en.wikipedia.org/wiki/Sine_and_cosine#:~:text=the%20ratio%20of%20the%20length%20of%20the%20side%20opposite%20that%20angle%20to%20the%20length%20of%20the%20longest%20side%20of%20the%20triangle) and [cos](https://en.wikipedia.org/wiki/Sine_and_cosine#:~:text=the%20ratio%20of%20the%20length%20of%20the%20adjacent%20leg%20to%20that%20of%20the%20hypotenuse) [trigonometric functions](https://en.wikipedia.org/wiki/Trigonometric_functions#:~:text=functions%20which%20relate%20an%20angle%20of%20a%20right%2Dangled%20triangle%20to%20ratios%20of%20two%20side%20lengths) used by Dec are designed for [t](#t){.tool data-bs-toggle="tooltip" data-bs-title="turns"} instead of [rad](#rad){.tool data-bs-toggle="tooltip" data-bs-title="radians"}.
::: {.equationgroup #equationgroup10}
$$\begin{split}
\text{eot} & = \beta_0 \\
& + \beta_1 \ast \text{cos(toy)} \\
& + \beta_2 \ast \text{sin(toy)} \\
& + \beta_3 \ast \text{cos(2} \ast \text{toy)} \\
& + \beta_4 \ast \text{sin(2} \ast \text{toy)}
\end{split}$$ {#eq-eot}
:::
By comparing the `sincost` and `sincos` functions, the code below demonstrates that using [t](#t){.tool data-bs-toggle="tooltip" data-bs-title="turns"} rather than [rad](#rad){.tool data-bs-toggle="tooltip" data-bs-title="radians"} can [yield more accurate results](https://en.wikipedia.org/wiki/Sine_and_cosine#:~:text=Representing%20angles%20in%20turns%20or%20half%2Dturns%20has%20accuracy%20advantages). Whereas `sincost` expects to receive [t](#t){.tool data-bs-toggle="tooltip" data-bs-title="turns"} and is always correct, `sincos` assumes that it will get [rad](#rad){.tool data-bs-toggle="tooltip" data-bs-title="radians"} and generates the slightly incorrect [E notation](https://en.wikipedia.org/wiki/Scientific_notation#E_notation) values below because it cannot produce zero unless its input is zero.
:::{.panel-tabset group="language"}
### Julia
```{julia}
sincost(x) = sincospi(2 * x)
sincost(0.25)
sincost(0.5)
sincost(0.75)
sincost(1)
sincos(0.25 * 2 * pi)
sincos(0.5 * 2 * pi)
sincos(0.75 * 2 * pi)
sincos(1 * 2 * pi)
```
### Observable JavaScript
```{ojs}
sincospi = require(
'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-sincospi@umd/browser.js'
)
function sincost(x) {
return sincospi(2 * x);
}
function sincos(x) {
return [Math.sin(x), Math.cos(x)]
}
sincost(0.25)
sincost(0.5)
sincost(0.75)
sincost(1)
sincos(0.25 * 2 * Math.PI)
sincos(0.5 * 2 * Math.PI)
sincos(0.75 * 2 * Math.PI)
sincos(1 * 2 * Math.PI)
```
### Python
```{python}
from math import cos, sin, pi, cospi, sinpi
def sincost(x):
x *= 2
return sinpi(x), cospi(x)
def sincos(x):
return sin(x), cos(x)
sincost(0.25)
sincost(0.5)
sincost(0.75)
sincost(1)
sincos(0.25 * 2 * pi)
sincos(0.5 * 2 * pi)
sincos(0.75 * 2 * pi)
sincos(1 * 2 * pi)
```
### R
```{r}
sincost <- function(x) {
x <- 2 * x
c(sinpi(x), cospi(x))
}
sincos <- function(x) {
c(sin(x), cos(x))
}
sincost(0.25)
sincost(0.5)
sincost(0.75)
sincost(1)
sincos(0.25 * 2 * pi)
sincos(0.5 * 2 * pi)
sincos(0.75 * 2 * pi)
sincos(1 * 2 * pi)
```
:::
The values below are the coefficients of a [harmonic](https://en.wikipedia.org/wiki/Harmonic#:~:text=positive%20integer%20multiple%20of%20the%20fundamental%20frequency) [model](https://en.wikipedia.org/wiki/Statistical_model#:~:text=embodies%20a%20set%20of%20statistical%20assumptions%20concerning%20the%20generation%20of%20sample%20data), adapted from the [National Oceanic and Atmospheric Administration](https://www.noaa.gov) ([NOAA](#noaa){#nationaloceanicandatmosphericadministration .tool data-bs-toggle="tooltip" data-bs-title="National Oceanic and Atmospheric Administration"}) [General Solar Position Calculations](https://gml.noaa.gov/grad/solcalc/solareqns.PDF). Before [fitting](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html) the model to [NOAA](#noaa){.tool data-bs-toggle="tooltip" data-bs-title="National Oceanic and Atmospheric Administration"} [yearly solar data](https://gml.noaa.gov/grad/solcalc/calcdetails.html), Dec divides [eot](#eot){.tool data-bs-toggle="tooltip" data-bs-title="equation of time"} values by 1.44 to convert minutes to [md](#md){.tool data-bs-toggle="tooltip" data-bs-title="millidays"}, converts [ymd](#ymd){.tool data-bs-toggle="tooltip" data-bs-title="year month day"} triplet dates and [hms](#hms){.tool data-bs-toggle="tooltip" data-bs-title="hour minute second"} triplet times into [ada](#ada){.tool data-bs-toggle="tooltip" data-bs-title="annual day aggregates"}, and sorts by [ada](#ada){.tool data-bs-toggle="tooltip" data-bs-title="annual day aggregate"}.
{{< embed eot.ipynb#eotcoef >}}
{{< include /dec/time/_eotplot.qmd >}}
In the [line📈chart](https://en.wikipedia.org/wiki/Line_chart#:~:text=a%20type%20of%20chart%20that%20displays%20information%20as%20a%20series%20of%20data%20points%20called%20%27markers%27%20connected%20by%20straight%20line%20segments) above, the [eot](#eot){.tool data-bs-toggle="tooltip" data-bs-title="equation of time"} values range from -9.8 to 11.4 [md](#md){.tool data-bs-toggle="tooltip" data-bs-title="millidays"} and the range of [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="days of year"}, [-365]{.color0} to [365]{.color365by366}, represents a common year followed by a leap year. The [absolute value](https://en.wikipedia.org/wiki/Absolute_value#:~:text=non%2Dnegative%29-,magnitude%20of,measured%20without%20regard%20to%20its%20sign,-.%20Namely%2C) of the [eot](#eot){.tool data-bs-toggle="tooltip" data-bs-title="equation of time"} reaches about one [centiday]{.tool data-bs-toggle="tooltip" data-bs-title="hundredth of a day"} ([cd]{.tool data-bs-toggle="tooltip" data-bs-title="centiday"}) on Days [245]{.color245by365} and [349]{.color349by365}, but passes through zero on Days [45]{.color045by365}, [103]{.color103by365}, [184]{.color184by365}, and [299]{.color299by365}. Therefore, [mst](#mst){.tool data-bs-toggle="tooltip" data-bs-title="mean solar time"} and [ast](#ast){.tool data-bs-toggle="tooltip" data-bs-title="apparent solar time"} are equivalent four times per year.
Apart from transforming an [mst](#mst){.tool data-bs-toggle="tooltip" data-bs-title="mean solar time"} into an [ast](#ast){.tool data-bs-toggle="tooltip" data-bs-title="apparent solar time"}, we can also use [eot](#eot){.tool data-bs-toggle="tooltip" data-bs-title="equation of time"} values to more accurately estimate the [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="times of day"} of [solar noon](https://en.wikipedia.org/wiki/Noon#:~:text=reaching%20its%20highest%20position%20above%20the%20horizon%20on%20that%20day%20and%20casting%20the%20shortest%20shadow), sunrise, and sunset. @eq-solarnoon below creates a [solar noon](https://en.wikipedia.org/wiki/Noon#:~:text=reaching%20its%20highest%20position%20above%20the%20horizon%20on%20that%20day%20and%20casting%20the%20shortest%20shadow) [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} by keeping only the decimal part of the result of subtracting a [w](#w){.tool data-bs-toggle="tooltip" data-bs-title="horizontal lines on a map"} longitude and an [eot](#eot){.tool data-bs-toggle="tooltip" data-bs-title="equation of time"} value that is measured in days from the sum of 9.55 and a [tzo](#tzo){.tool data-bs-toggle="tooltip" data-bs-title="time zone offset"} that is measured in days.
::: {.equationgroup #equationgroup11}
$$\text{solarnoon} = \left(9.55 + \text{tzo} - \text{w} - \text{eot}\right) \bmod 1$$ {#eq-solarnoon}
:::
# Cambridge and Cambridge {#sec-cac .hiddenheading}
To compare the solar noon [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} in two cities, we can plug the longitude of each city into @eq-solarnoon above. If all of the variables other than longitude in @eq-solarnoon are set to zero, the resulting solar noon [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} is almost five [decidays]{.tool data-bs-toggle="tooltip" data-bs-title="tenths of a day"} for [Cambridge, England](https://en.wikipedia.org/wiki/Cambridge#:~:text=a%20city%20and%20non%2Dmetropolitan%20district%20in%20the%20county%20of%20Cambridgeshire%2C%20England) in the [United Kingdom](https://en.wikipedia.org/wiki/United_Kingdom#:~:text=a%20country%20in%20Northwestern%20Europe) and nearly seven [decidays]{.tool data-bs-toggle="tooltip" data-bs-title="tenths of a day"} for [Cambridge, Massachusetts](https://en.wikipedia.org/wiki/Cambridge,_Massachusetts#:~:text=a%20city%20in%20Middlesex%20County%2C%20Massachusetts%2C%20United%20States) in the [United States](https://en.wikipedia.org/wiki/United_States#:~:text=a%20country%20primarily%20located%20in%20North%20America).
::: {.equationgroup #equationgroup12}
$$4.99635 = (9.55 - 0.050365) \bmod 1 \ast 10$$ {#eq-cambridgeuk}
$$6.97517 = (9.55 - 0.852484) \bmod 1 \ast 10$$ {#eq-cambridgema}
:::
The two homonymous cities are about two [dw](#dw){.tool data-bs-toggle="tooltip" data-bs-title="deciwěi"} apart and therefore will always differ by around two [decidays]{.tool data-bs-toggle="tooltip" data-bs-title="tenths of a day"} in solar time, regardless of what time zone we use as our frame of reference. England is in Zone [0]{.color0} and Massachusetts is in Zone [8]{.color8}. From the perspective of Zone [8]{.color8}, solar noon is roughly [Tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} [5]{.color5} in Cambridge, MA and about [Tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} [3]{.color3} in Cambridge, UK.
::: {.equationgroup #equationgroup13}
$$2.99635 = (9.55 + 0.8 - 0.050365) \bmod 1 \ast 10$$ {#eq-cambridgeuk8}
$$4.97517 = (9.55 + 0.8 - 0.852484) \bmod 1 \ast 10$$ {#eq-cambridgema8}
:::
# Light arc whole (law) {#sec-law .hiddenheading}
The path in the sky that the Sun appears to follow from a sunrise to a sunset is a "light [arc](https://en.wikipedia.org/wiki/Sun_path#:~:text=arc%2Dlike%20path%20that%20the%20Sun%20appears%20to%20follow%20across%20the%20sky) whole" ([law](#law){#lightarcwhole .tool data-bs-toggle="tooltip" data-bs-title="light arc whole"}). Solar noon, the midpoint of a [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"}, is halfway between sunrise and sunset. A [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} can be evenly split into two "light arc halves" ([lah](#lah){#lightarchalf .tool data-bs-toggle="tooltip" data-bs-title="light arc half"}). Whereas [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="times of day"} are time points, [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc wholes"} and [lah](#lah){.tool data-bs-toggle="tooltip" data-bs-title="light arc halves"} are durations. The difference between a solar noon [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} and a [lah](#lah){.tool data-bs-toggle="tooltip" data-bs-title="light arc half"} is a sunrise [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"}.
::: {.equationgroup #equationgroup14}
$$\text{law} = \text{lah} \ast 2$$ {#eq-law}
$$\begin{split}
\text{sunrise}
& = \text{solarmidnight} + \text{nah} \\
& = \text{solarnoon} - \text{lah} \\
& = \text{sunset} - \text{law}
\end{split}$$ {#eq-sunrise}
$$\begin{split}
\text{sunset}
& = \text{solarmidnight} + \text{nah} + \text{law} \\
& = \text{sunrise} + \text{law} \\
& = \text{solarnoon} + \text{lah} \\
\end{split}$$ {#eq-sunset}
:::
# Night arc whole (naw) {#sec-naw .unnumbered .hiddenheading}
The Sun continues its path after it disappears below the horizon, moving from sunset to sunrise along a "night arc whole" ([naw](#naw){#nightarcwhole .tool data-bs-toggle="tooltip" data-bs-title="night arc whole"}). Like [conjugate angles](https://en.wikipedia.org/wiki/Angle#:~:text=conjugate%20angles%20sum%20to%20a%20full%20angle), a [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} and a [naw](#naw){.tool data-bs-toggle="tooltip" data-bs-title="night arc whole"} form a full circle that represents one day. Likewise, a [lah](#lah){.tool data-bs-toggle="tooltip" data-bs-title="light arc half"} and a "night arc half" ([nah](#nah){#nightarchalf .tool data-bs-toggle="tooltip" data-bs-title="night arc half"}) are like two [supplementary angles](https://en.wikipedia.org/wiki/Angle#:~:text=sum%20to%20a%20straight%20angle) that form a semicircle from solar noon to the [naw](#naw){.tool data-bs-toggle="tooltip" data-bs-title="night arc whole"} midpoint: [solar midnight](https://en.wikipedia.org/wiki/Midnight#:~:text=the%20time%20opposite%20to%20solar%20noon%2C%20when%20the%20Sun%20is%20closest%20to%20the%20nadir%2C%20and%20the%20night%20is%20equidistant%20from%20dusk%20and%20dawn).
::: {.equationgroup #equationgroup15}
$$\text{naw} = \text{nah} \ast 2$$ {#eq-naw}
$$\begin{split}
\text{day}
& = \text{law} + \text{naw} \\
& = (\text{lah} + \text{nah}) \ast 2
\end{split}$$ {#eq-day}
$$\begin{split}
\text{solarmidnight}
&= \text{sunrise} - \text{nah} \\
&= \text{solarnoon} - \text{lah} - \text{nah} \\
&= \text{sunset} - \text{law} - \text{nah}
\end{split}$$ {#eq-solarmidnight}
:::
The range input below controls the yellow [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} and the blue [naw](#naw){.tool data-bs-toggle="tooltip" data-bs-title="night arc whole"} in the diagram beneath it. At the Equator, the sun always rises about a quarter turn from North and sets around three quarter turns from North, resulting in a [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} of roughly half a day: 75% − 25% = 50%. If the [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} is zero, a [polar night](https://en.wikipedia.org/wiki/Polar_night#:~:text=the%20Sun%20remains%20below%20the%20horizon%20for%20more%20than%2024%C2%A0hours) occurs. A day without a [naw](#naw){.tool data-bs-toggle="tooltip" data-bs-title="night arc whole"} is called a [polar day](https://en.wikipedia.org/wiki/Midnight_sun#:~:text=the%20Sun%20remains%20visible%20at%20the%20local%20midnight).
{{< include /dec/time/_dayarcplot.qmd >}}
The numbers in the diagram above are ["solar azimuth angle"](https://en.wikipedia.org/wiki/Solar_azimuth_angle#:~:text=horizontal%20angle%20with%20respect%20to%20north) ([saa](#saa){#solarazimuthangle .tool data-bs-toggle="tooltip" data-bs-title="solar azimuth angle"}) [milliturns]{.tool data-bs-toggle="tooltip" data-bs-title="thousandths of a turn"} ([mt](#mt){#milliturn .tool data-bs-toggle="tooltip" data-bs-title="milliturns"}). At solar noon, the [saa](#saa){.tool data-bs-toggle="tooltip" data-bs-title="solar azimuth angle"} is 0 [mt](#mt){.tool data-bs-toggle="tooltip" data-bs-title="milliturns"} in the [Southern Hemisphere](https://en.wikipedia.org/wiki/Southern_Hemisphere#:~:text=the%20half%20%28hemisphere%29%20of%20Earth%20that%20is%20south%20of%20the%20equator) and 500 [mt](#mt){.tool data-bs-toggle="tooltip" data-bs-title="milliturns"} in the [Northern Hemisphere](https://en.wikipedia.org/wiki/Northern_Hemisphere#:~:text=the%20half%20of%20Earth%20that%20is%20north%20of%20the%20equator). The [radio](https://observablehq.github.io/framework/inputs/radio#:~:text=allows%20the%20user%20to%20choose%20one%20of%20a%20given%20set%20of%20values)📻input above controls whether the midpoint of the [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} is 0 or 500 [mt](#mt){.tool data-bs-toggle="tooltip" data-bs-title="milliturns"}. To measure the [saa](#saa){.tool data-bs-toggle="tooltip" data-bs-title="solar azimuth angle"} during the [daytime](https://en.wikipedia.org/wiki/Daytime#:~:text=the%20period%20of%20the%20day%20in%20which%20the%20Sun%20is%20above%20the%20local%20horizon%20in%20a%20given%20location), point a compass🧭at the spot on the horizon below the Sun.
During an [equinox](https://en.wikipedia.org/wiki/Equinox#:~:text=a%20moment%20in%20time%20when%20the%20Sun%20appears%20directly%20above%20the%20equator) at the Equator, the Sun goes from East to West directly overhead, the [saa](#saa){.tool data-bs-toggle="tooltip" data-bs-title="solar azimuth angle"} flips like a switch from 0.25 [t](#t){.tool data-bs-toggle="tooltip" data-bs-title="turns"} to 0.75 [t](#t){.tool data-bs-toggle="tooltip" data-bs-title="turns"} at solar noon, the "[solar elevation angle](https://en.wikipedia.org/wiki/Solar_zenith_angle#Summary_of_special_angles:~:text=For%20example%2C%20the-,solar,-elevation%20angle%20is)" ([sea](#sea){#solarelevationangle .tool data-bs-toggle="tooltip" data-bs-title="solar elevation angle"}) peaks at 0.25 [t](#t){.tool data-bs-toggle="tooltip" data-bs-title="turns"}, and [ast](#ast){.tool data-bs-toggle="tooltip" data-bs-title="apparent solar time"} is 0.5 − sin([saa](#saa){.tool data-bs-toggle="tooltip" data-bs-title="solar azimuth angle"}) × (0.25 − [sea](#sea){.tool data-bs-toggle="tooltip" data-bs-title="solar elevation angle"}). To obtain the [sea](#sea){.tool data-bs-toggle="tooltip" data-bs-title="solar elevation angle"}, we can use the height (h) of a vertical rod on a level surface and the length (L) of its shadow: [sea](#sea){.tool data-bs-toggle="tooltip" data-bs-title="solar elevation angle"} = atan2(h, L).
In addition to determining the [sea](#sea){.tool data-bs-toggle="tooltip" data-bs-title="solar elevation angle"}, the [atan2](https://en.wikipedia.org/wiki/Atan2#:~:text=function%20atan2%20is-,the%202%2Dargument%20arctangent,-.%20By%20definition%2C) function can also be used to calculate [ast](#ast){.tool data-bs-toggle="tooltip" data-bs-title="apparent solar time"}, as shown in @eq-astjing, where [j](#j){#jing .tool data-bs-toggle="tooltip" data-bs-title="jīng"} is a latitude measured in turns called [jīng](https://en.wikipedia.org/wiki/Meridian_arc#Full_meridian_(polar_perimeter):~:text=The%20polar%20Earth%27s%20circumference%20is%20simply%20four%20times%20quarter%20meridian) ([j](#j){.tool data-bs-toggle="tooltip" data-bs-title="jīng"}). In Dec, [inverse trigonometric](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#:~:text=obtain%20an%20angle%20from%20any%20of%20the%20angle%27s%20trigonometric%20ratios) functions like [atan2](https://en.wikipedia.org/wiki/Atan2#:~:text=function%20atan2%20is-,the%202%2Dargument%20arctangent,-.%20By%20definition%2C) yield [t](#t){.tool data-bs-toggle="tooltip" data-bs-title="turns"} as opposed to [rad](#rad){.tool data-bs-toggle="tooltip" data-bs-title="radians"}. At the Equator ([j](#j){.tool data-bs-toggle="tooltip" data-bs-title="jīng"} = 0), the latitude is zero and @eq-astjing simplifies to [ast](#ast){.tool data-bs-toggle="tooltip" data-bs-title="apparent solar time"} = 0.5 + atan2(-sin([saa](#saa){.tool data-bs-toggle="tooltip" data-bs-title="solar azimuth angle"})cos([sea](#sea){.tool data-bs-toggle="tooltip" data-bs-title="solar elevation angle"}), sin([sea](#sea){.tool data-bs-toggle="tooltip" data-bs-title="solar elevation angle"})).
::: {.equationgroup #equationgroup16}
$$
\text{ast} = 0.5 + \text{atan2}\!\!\left(
\begin{aligned}
& \text{-sin(saa)cos(sea),} \\
& \text{sin(sea)cos(j) } - \\
& \text{cos(saa)cos(sea)sin(j)}
\end{aligned}
\right)
$$ {#eq-astjing}
$$
\text{ast} =
\begin{cases}
\text{saa} & \text{j} = 0.25 \\
\text{atan2(-sin(saa)cos(sea), sin(sea))} & \text{j} = 0 \\
(1.5 - \text{saa}) \bmod 1 & \text{j} = -0.25
\end{cases}
$$ {#eq-extremes}
:::
At the North Pole ([j](#j){.tool data-bs-toggle="tooltip" data-bs-title="jīng"} = 0.25), the latitude is 0.25 [j](#j){.tool data-bs-toggle="tooltip" data-bs-title="jīng"} and @eq-astjing simplifies to [ast](#ast){.tool data-bs-toggle="tooltip" data-bs-title="apparent solar time"} = [saa](#saa){.tool data-bs-toggle="tooltip" data-bs-title="solar azimuth angle"}. At the South Pole ([j](#j){.tool data-bs-toggle="tooltip" data-bs-title="jīng"} = -0.25), the latitude is -0.25 [j](#j){.tool data-bs-toggle="tooltip" data-bs-title="jīng"} and @eq-astjing simplifies to [ast](#ast){.tool data-bs-toggle="tooltip" data-bs-title="apparent solar time"} = 0.5 − [saa](#saa){.tool data-bs-toggle="tooltip" data-bs-title="solar azimuth angle"} before solar noon or [ast](#ast){.tool data-bs-toggle="tooltip" data-bs-title="apparent solar time"} = 1.5 − [saa](#saa){.tool data-bs-toggle="tooltip" data-bs-title="solar azimuth angle"} after solar noon. In between the Equator and the South or North Pole (-0.25 < [j](#j){.tool data-bs-toggle="tooltip" data-bs-title="jīng"} < 0 ∨ 0 < [j](#j){.tool data-bs-toggle="tooltip" data-bs-title="jīng"} < 0.25), we should use Equation -@eq-ast, -@eq-astjing, or -@eq-astsha.
::: {.equationgroup #equationgroup17}
$$
\text{ast} = 0.5 + \text{arccos}\!\!\left(\dfrac{\text{sin(sea)} - \text{sin(j)sin(sda)}}{\text{cos(j)cos(sda)}}\right) \ast
\begin{cases}
\text{-}1 & 0 \le \text{saa} < 0.5 \\
1 & 0.5 \le \text{saa} < 1
\end{cases}
$$ {#eq-astsha}
:::
Unlike @eq-astjing, @eq-astsha requires a "solar declination angle" ([sda](#sda){#solardeclinationangle .tool data-bs-toggle="tooltip" data-bs-title="solar declination angle"}). Whereas latitude is the angle from the Equator in the [geographic coordinate system](https://en.wikipedia.org/wiki/Geographic_coordinate_system#:~:text=a%20spherical%20or%20geodetic%20coordinate%20system%20for%20measuring%20and%20communicating%20positions%20directly%20on%20Earth%20as%20latitude%20and%20longitude), [declination](https://en.wikipedia.org/wiki/Declination#:~:text=the%20angular%20distance%20from%20the%20celestial%20equator%20on%20the%20celestial%20sphere) is the angle from the [celestial equator](https://en.wikipedia.org/wiki/Celestial_equator) in the [equatorial coordinate system](https://en.wikipedia.org/wiki/Equatorial_coordinate_system#:~:text=a%20celestial%20coordinate%20system%20widely%20used%20to%20specify%20the%20positions%20of%20celestial%20objects). For simplicity, we can use @eq-eot for both the [eot](#eot){.tool data-bs-toggle="tooltip" data-bs-title="equation of time"} and [sda](#sda){.tool data-bs-toggle="tooltip" data-bs-title="solar declination angle"}. The line plot below shows [sda](#sda){.tool data-bs-toggle="tooltip" data-bs-title="solar declination angles"} over the course of a year.
{{< include /dec/time/_sdaplot.qmd >}}
In the line plot above, [zero crossings](https://en.wikipedia.org/wiki/Zero_crossing#:~:text=a%20point%20where%20the%20sign%20of%20a%20mathematical%20function%20changes) are [equinoxes](https://en.wikipedia.org/wiki/Equinox#:~:text=a%20moment%20in%20time%20when%20the%20Sun%20appears%20directly%20above%20the%20equator%2C%20rather%20than%20to%20its%20north%20or%20south) and [stationary points](https://en.wikipedia.org/wiki/Stationary_point#:~:text=a%20point%20on%20the%20graph%20of%20the%20function%20where%20the%20function%27s%20derivative%20is%20zero) are [solstices](https://en.wikipedia.org/wiki/Solstice#:~:text=the%20time%20when%20the%20Sun%20reaches%20its%20most%20northerly%20or%20southerly%20sun%20path%20relative%20to%20the%20celestial%20equator%20on%20the%20celestial%20sphere). From the northward to the southward equinox, the [sda](#sda){.tool data-bs-toggle="tooltip" data-bs-title="solar declination angle"} is positive and every latitude in the Northern Hemisphere has a [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} that is longer than the [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} at the Equator, whereas every latitude in the Southern Hemisphere has a shorter one. This pattern is reversed when the [sda](#sda){.tool data-bs-toggle="tooltip" data-bs-title="solar declination angle"} is negative.
The chart below splits the [Socioeconomic Data and Applications Center](https://www.earthdata.nasa.gov/centers/sedac-daac) population data into two bars representing the Northern and Southern Hemispheres and then further divides each bar by [UTC](#utc){.tool data-bs-toggle="tooltip" data-bs-title="Coordinated Universal Time"} offset. Nearly 7 billion out of a total of almost 8 billion people live in the Northern Hemisphere and thus experience the longest [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} of the year at the [northern solstice](https://en.wikipedia.org/wiki/June_solstice#:~:text=In%20the%20Northern%20Hemisphere%2C%20the%20June%20solstice%20is%20the%20summer%20solstice%20%28the%20day%20with%20the%20longest%20period%20of%20daylight%29%2C%20while%20in%20the%20Southern%20Hemisphere%20it%20is%20the%20winter%20solstice%20%28the%20day%20with%20the%20shortest%20period%20of%20daylight%29).
{{< include /dec/time/_hemipopplot.qmd >}}
The top range input below picks the [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="day of year"} that we will convert into a [toy](#toy){.tool data-bs-toggle="tooltip" data-bs-title="time of year"} and then pass to our [sda](#sda){.tool data-bs-toggle="tooltip" data-bs-title="solar declination angle"} model. The two range inputs beneath the [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="day of year"} input choose the geographic coordinates needed to find the sunrise and sunset [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="times of day"}. While the sunrise and sunset [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="times of day"} rely on the [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="day of year"} and both geographic coordinates, the [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} depends on the [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="day of year"} and latitude but not on longitude. The default latitude, 118 [mj](#mj){.tool data-bs-toggle="tooltip" data-bs-title="millijīng"}, is that of Cambridge, Massachusetts. At the Equator, the [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} is about 0.505 [d](#d){.tool data-bs-toggle="tooltip" data-bs-title="days"} all year long, so the [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="day of year"} input changes the [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} only away from the Equator: \${selectedSunset.toFixed(3)} − \${selectedSunrise.toFixed(3)} = \${parseFloat(daytimeDuration.toFixed(3))}.
```{ojs}
//| echo: false
//| label: doyinput
//| class: slider
viewof doyInput = Inputs.range([0, 365], {label: "Day of year", value: 183, step: 1})
```
```{ojs}
//| echo: false
//| label: latinput
//| class: slider
viewof latInput = Inputs.range([-250, 250], {label: "Latitude", value: 118, step: 1})
```
```{ojs}
//| echo: false
//| label: loninput1
//| class: slider
Inputs.bind(Inputs.range([0, 1000], {step: 1, label: "Longitude"}), viewof lonInput)
```
The equation above can be summarized as sunset − sunrise = [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} or [minuend](https://en.wiktionary.org/wiki/minuend#:~:text=A%20number%20or%20quantity%20from%20which%20another%20is%20to%20be%20subtracted) − [subtrahend](https://en.wikipedia.org/wiki/Subtraction#:~:text=number%20being%20subtracted) = [difference](https://en.wikipedia.org/wiki/Subtraction#Notation_and_terminology:~:text=The%20result%20is%20the%20difference). If we replace the minuend (sunset [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"}) with the current [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} and the subtrahend (sunrise [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"}) with the sunset [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"}, the difference will no longer be the [law](#law){.tool data-bs-toggle="tooltip" data-bs-title="light arc whole"} but rather the time until sunset if it is negative or since sunset if it is positive: \${selectedCurrent.toFixed(3)} = \${selectedSunset.toFixed(3)} [${selectedDifference < 0 ? "-" : "+"}]{.mono} \${parseFloat(Math.abs(selectedDifference).toFixed(3))}.
In general, the subtrahend is the time of an event such as a rocket🚀launch and the difference is the negative [remaining time](https://en.wikipedia.org/wiki/Countdown#:~:text=the%20time%20remaining%20before%20an%20event) if the minuend is less than the subtrahend or the positive [elapsed time](https://en.wikipedia.org/wiki/Mission_Elapsed_Time) if the minuend is greater than the subtrahend. When the minuend is the current time, the difference acts as a ["T minus (T−) countdown"](https://en.wikipedia.org/wiki/Countdown#:~:text=a%20sequence%20of%20backward%20counting%20to%20indicate%20the%20time%20remaining) or ["T plus (T+) countup"](https://en.wikipedia.org/wiki/Countdown#:~:text=After%20a%20launch%2C%20most%20countdown%20clocks%20begin%20to%20show%20Mission%20Elapsed%20Time).
::: {.equationgroup #equationgroup18}
$$\begin{cases}\text{difference}<0&{\text{if } \text{minuend} < \text{subtrahend};}\\\text{difference}=0&{\text{if minuend} = \text{subtrahend};}\\\text{difference}>0&{\text{if minuend}>\text{subtrahend.}}\end{cases}$$ {#eq-difference}
:::
Dec uses the term "minuend expansion" to describe the replacement of a minuend with a subtrahend and a difference. We can replace the current [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} with the sum of either zero and a "positive interval [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"}" ([pit](#pit){#positiveintervaltod .tool data-bs-toggle="tooltip" data-bs-title="positive interval tod"}), which is the time since the start of the current day (the previous midnight), or 1 day ([d](#d){#day .tool data-bs-toggle="tooltip" data-bs-title="day"}) and a "negative interval [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"}" ([nit](#nit){#negativeintervaltod .tool data-bs-toggle="tooltip" data-bs-title="negative interval tod"}), which is the negative of the time until the start of the next day (the next midnight), as shown in @eq-todexpansion below. At [Tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} [7]{.color7}, the [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} and [pit](#pit){.tool data-bs-toggle="tooltip" data-bs-title="positive interval tod"} are both 0.7 [d](#d){.tool data-bs-toggle="tooltip" data-bs-title="days"} and the [nit](#nit){.tool data-bs-toggle="tooltip" data-bs-title="negative interval tod"} is -0.3 [d](#d){.tool data-bs-toggle="tooltip" data-bs-title="days"}: 0.7 = 0 + 0.7 = 1 + (-0.3).
Likewise, a "positive interval [ada](#ada){.tool data-bs-toggle="tooltip" data-bs-title="annual day aggregate"}" ([pia](#pia){#positiveintervalada .tool data-bs-toggle="tooltip" data-bs-title="positive interval ada"}) is the time since the start of the current year and a "negative interval [ada](#ada){.tool data-bs-toggle="tooltip" data-bs-title="annual day aggregate"}" ([nia](#nia){#negativeintervalada .tool data-bs-toggle="tooltip" data-bs-title="negative interval ada"}) is the time until the start of the next year. A [pia](#pia){.tool data-bs-toggle="tooltip" data-bs-title="positive interval ada"} equals the current [ada](#ada){.tool data-bs-toggle="tooltip" data-bs-title="annual day aggregate"}, and a [nia](#nia){.tool data-bs-toggle="tooltip" data-bs-title="negative interval ada"} is the [pia](#pia){.tool data-bs-toggle="tooltip" data-bs-title="positive interval ada"} minus the [syl](#syl){.tool data-bs-toggle="tooltip" data-bs-title="solar year length"}, just as a "negative integer [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="day of year"}" ([nid](#nid){.tool data-bs-toggle="tooltip" data-bs-title="negative integer day of year"}) is a "positive integer [doy](#doy){.tool data-bs-toggle="tooltip" data-bs-title="day of year"}" ([pid](#pid){.tool data-bs-toggle="tooltip" data-bs-title="positive integer day of year"}) minus the [syl](#syl){.tool data-bs-toggle="tooltip" data-bs-title="solar year length"}. @eq-adaexpansion applies minuend expansion to the [ada](#ada){.tool data-bs-toggle="tooltip" data-bs-title="annual day aggregate"}.
::: {.equationgroup #equationgroup19}
$$\text{tod} = 0 + \text{pit} = 1 + \text{nit}$$ {#eq-todexpansion}
$$\text{ada} = 0 + \text{pia} = \text{syl} + \text{nia}$$ {#eq-adaexpansion}
:::
Dec is not the first system to use [decimal time](https://en.wikipedia.org/wiki/Decimal_time#France). During the [French Revolution](https://en.wikipedia.org/wiki/French_Revolution), decimal time was mandatory for French public records for 197 days ([d](#d){#day .tool data-bs-toggle="tooltip" data-bs-title="days"}), from [1794]{.color94by100}+[205]{.color205by365} to [1795]{.color95by100}+[037]{.color037by365}. On [1998]{.color98by100}+[247]{.color247by365}, the Swatch corporation announced [Swatch Internet Time](https://en.wikipedia.org/wiki/Swatch_Internet_Time), which divides the day into 1000 ".beats", only has one time zone, and is displayed by Dec as [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"}−β.
Declock measures time in fractional days. A single decimal [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} replaces the three parts of an [hms](#hms){.tool data-bs-toggle="tooltip" data-bs-title="hour minute second"} triplet and can be shown at any precision by changing its metric prefix. With one [b9](#b9){.tool data-bs-toggle="tooltip" data-bs-title="base9"} digit and one [b24](#b24){.tool data-bs-toggle="tooltip" data-bs-title="base24"} digit after four [b10](#b10){.tool data-bs-toggle="tooltip" data-bs-title="base10"} digits, a [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} can match any [hms](#hms){.tool data-bs-toggle="tooltip" data-bs-title="hour minute second"} triplet exactly, and a [uto](#uto){.tool data-bs-toggle="tooltip" data-bs-title="universal time offset"} keeps Dec in step with [ut](#ut){.tool data-bs-toggle="tooltip" data-bs-title="Universal Time"} without leap seconds. Dec derives its ten [tzo](#tzo){.tool data-bs-toggle="tooltip" data-bs-title="time zone offsets"} from longitude and never uses negative offsets, but it lets anyone write any [sto](#sto){.tool data-bs-toggle="tooltip" data-bs-title="solar time offset"} after a [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} without forcing them to change it. With the [eot](#eot){.tool data-bs-toggle="tooltip" data-bs-title="equation of time"} and [sda](#sda){.tool data-bs-toggle="tooltip" data-bs-title="solar declination angle"}, we can turn a Zone [0]{.color0} [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} into solar time and estimate the [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="times of day"} of sunrise, solar noon, and sunset. Finally, minuend expansion turns any [tod](#tod){.tool data-bs-toggle="tooltip" data-bs-title="time of day"} into a countdown or countup relative to an event, such as midnight, sunset, or the start of the year.
# Next {#next .unnumbered}
The next article in the [Dec section](/dec) of my [site](/) shows how we can combine [Dec dates](/dec/date) and times into [Dec snaps](/dec/snap)🫰, which are analogous to the [combined date and time representations](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#:~:text=an%20international%20standard%20covering%20the%20worldwide%20exchange%20and%20communication%20of%20date%20and%20time%2Drelated%20data) international standard for dates and times. The final article in the Dec section demonstrates how Dec dates, times, and snaps🫰can be paired up to express [time intervals](https://en.wikipedia.org/wiki/ISO_8601#Time_intervals:~:text=the%20intervening%20time%20between%20two%20time%20points) called Dec [spans](/dec/span)🌈.
::: {.timenav}
{{< include /asset/_decnav.qmd >}}
:::
Please spread the good word about Dec using the citation information at the bottom of this article. You may also want to cite the Observable notebooks that I adapted into the clock🕓, bar📊chart, map🗺️, and daylight☀️plot visualizations in this article or the 2014 blog post which proposed a system of 20 decimal time zones, each 5 [centidays]{.tool data-bs-toggle="tooltip" data-bs-title="hundredths of a day"} wide, based on the [Greenwich Meridian](https://en.wikipedia.org/wiki/Prime_meridian_(Greenwich)#:~:text=a%20geographical%20reference%20line%20that%20passes%20through%20the%20Royal%20Observatory%2C%20Greenwich%2C%20in%20London%2C%20England):
- [Pearson, Tom](https://www.2x2.graphics). [[2013]{.underline}]{}[+[124]{}]{.underline}. “Simple D3 clock.” [\${decYear}]{}+[\${decDate}]{}. [https://observablehq.com/\@d3/simple-clock](https://observablehq.com/@d3/simple-clock){.uri}.
- [Heyen, Frank](https://fheyen.github.io). [[2021]{.underline}]{}[+[246]{}]{.underline}. “BarChart Clock.” [\${decYear}]{}+[\${decDate}]{}. [https://observablehq.com/\@fheyen/barchart-clock](https://observablehq.com/@fheyen/barchart-clock){.uri}.
- [Johnson, Ian](https://enjalot.github.io). [[2021]{.underline}]{}[+[090]{}]{.underline}. “Draggable World Map Coordinates Input.” [\${decYear}]{}+[\${decDate}]{}. [https://observablehq.com/\@enjalot/draggable-world-map-coordinates-input](https://observablehq.com/@enjalot/draggable-world-map-coordinates-input){.uri}.
- [Bridges, Dan](https://www.danbridges.org). [[2021]{.underline}]{}[+[311]{}]{.underline}. “Visualizing Seasonal Daylight.” [\${decYear}]{}+[\${decDate}]{}. [https://observablehq.com/\@dbridges/visualizing-seasonal-daylight](https://observablehq.com/@dbridges/visualizing-seasonal-daylight){.uri}.
- [Clements, John](https://www.brinckerhoff.org). [[2014]{.underline}]{}[+[091]{}]{.underline}, “Decimal Time Zones.” [\${decYear}]{}+[\${decDate}]{}. <https://www.brinckerhoff.org/blog/2014/05/31/decimal-time-zones>.
{{< include /asset/_cite.qmd >}}
{{< include /asset/_glossary.qmd >}}
{{< include /dec/time/_index.qmd >}}