[ntp:questions] Leap second to be introduced in June

Terje Mathisen terje.mathisen at tmsw.no
Mon Jan 26 17:56:18 UTC 2015

David Malone wrote:
> Terje Mathisen <terje.mathisen at tmsw.no> writes:
>> One of the good points about Google's smear is the fact that they use a
>> half cosine to distribute the offset, which means that they have a time
>> function which is both continuous and monotonic, as well as having an
>> infinite number of defined derivatives, i.e. it is maximally smooth.
> Doesn't it only have two smooth deritives at the end points or
> [-w:w]? The usual function is constant 1 with all derivatves zero,
> and so this is what the derivative should be at the endpoints. They
> use (1.0 - cos(pi * t / w)) / 2.0, which is 1 at both end point,
> has first derative zero, but the second deritive is -pi*pi/w/w.

The derivatives of sine/cosine are of course +/- cosine/sine, so they 
stay smooth at all levels.

Google uses a half cosine, i.e. something like

   adjustment = (1-cos(t * pi/adjustment_period))*adjustment_value/2;

Since the adjustment_value is +/- a second, the normal form is

   adjustment = (1-cos(t*pi/adjustment_period))/2;

which is zero at t=0 and +1 at t==adjustment_period.

> (It should be possible to stitch together something that is infinitely
> smooth, probably using exp(-1/(x*x)), but it would requite a bit
> more work.)

Doesn't seem to be needed?


- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

More information about the questions mailing list