About ntp.smoothtime.org
If democracy truly was the ruling principle in the EU, annual clock
switching would have been abolished a long time ago. As long as
politicians cannot agree on a continuous stime scheme, we need to
make the best of the situation. Especially during the spring clock
switch, I normally feel sleep deprived for about three weeks. As a
bio hack, I tried fasting for 24 hours to desynchronize my
biological clock, hoping it would happily adopt the new rhythm when
fasting was over. That worked to a certain degree in the past two
years, but still was not the perfect solution. This year, I try to
gradually adapt to the new time over a period of 12 days, at a rate
of 5 minutes per day. But my computer and DECT phone kept showing
the governmental time, and my router did not allow to set the time
manually. So the idea was born to set up an NTP server that "lies"
to its clients about UTC time in such a way that regular computers
and electronic devices would show the smoothly adapting time.
At 6 * 24 = 144 hours before the spring clock switch, the server
begins to linearly ramp up an applied time correction, reaching +30
minutes at the time of the governmental clock switch. At that time,
the time correction is set to -30 minutes, and than linearly ramped
to zero over the following 144 hours. The leap of -1 hour
compensates for the governmental leap of +1 hour in clients that
automatically apply it (like most PCs), and the result is a smooth
transition from standard time to daylight saving time over the
course of 12 * 24 hours. Of course, the leap in fake UTC time may
upset some clients that use sophisticated algorithms to establish a
stable local clock assuming a continuous reference time. For
example, I had to reboot my router to transfer the new time to the
DECT phone the morning after the governmental time switch. But in
general, it appears to work and supports me in gradually adapting to
daylight saving time this year.
The server code is based on OpenNTPD 6.2p3 from http://www.openntpd.org/portable.html
with the following source code modification:
--- a/src/server.c
+++ b/src/server.c
@@ -29,6 +29,28 @@
#include "ntpd.h"
+double smoothtime(double t)
+{
+ const double t0 = 3794432400.0; // calendar.timegm([2020,3,29,1,0,0])+2208988800
+ const double t1 = t0 - 6.0 * 86400.0;
+ const double t2 = t0 + 6.0 * 86400.0;
+ const double dist = 3600.;
+ const double ramp = dist / (t2 - t1);
+
+ if( t < t1 || t > t2 )
+ {
+ return t;
+ }
+ if( t < t0 )
+ {
+ return t + ramp * (t - t1);
+ }
+ else
+ {
+ return t + ramp * (t - t2);
+ }
+}
+
int
setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
{
@@ -213,9 +235,9 @@ server_dispatch(int fd, struct ntpd_conf *lconf)
reply.stratum = lconf->status.stratum;
reply.ppoll = query.ppoll;
reply.precision = lconf->status.precision;
- reply.rectime = d_to_lfp(rectime);
- reply.reftime = d_to_lfp(lconf->status.reftime);
- reply.xmttime = d_to_lfp(gettime_corrected());
+ reply.rectime = d_to_lfp(smoothtime(rectime));
+ reply.reftime = d_to_lfp(smoothtime(lconf->status.reftime));
+ reply.xmttime = d_to_lfp(smoothtime(gettime_corrected()));
reply.orgtime = query.xmttime;
reply.rootdelay = d_to_sfp(lconf->status.rootdelay);
reply.refid = lconf->status.refid;
As you can see, this is still very experimental and currently only
implements smooth time for the 2020 spring clock switch. Plans are
to add code for further clock switches in the future.
If you find this idea useful, you may use the NTP server
ntp.smoothtime.org free of charge, but at your own risk!
Update October 18, 2020: The code has been extended to also ramp time back to normal during 12 days around the time switch next weekend, and to accomodate time switching in 2021.
Update March 21, 2023: The code has been updated for clock switching until 2050.
Page created by: Joachim Schueth, Bonn