In addition to TCP/IP, there are many ways to synchronize time. Some of them require only a regular phone, while others need expensive, rare, and sensitive electronic equipment. The extensive infrastructure for time synchronization systems includes observatories, government institutions, radio stations, satellite groups, and much more.
Today, I will explain how time synchronization works without the internet and how to create a "satellite" NTP server by yourself.
Shortwave Broadcasting
In the United States, NIST broadcasts precise time and frequency at 2.5, 5, 10, 15, and 20 MHz from the WWVH station in Fort Collins, Colorado, and at frequencies of 2.5, 5, 10, and 15 MHz from the WWVH station in Kauai, Hawaii. The time code is transmitted over a 60-second interval at a speed of 1 b/s using amplitude modulation on a 100 Hz subcarrier.
The National Research Council (NRC) of Canada broadcasts timing and frequency information at 3.33, 7.85, and 14.67 MHz from the CHU station in Ottawa, Ontario.

WWVH Broadcasting Format
Signal distribution from shortwave stations usually occurs through reflection from the upper layers of the ionosphere. Signal transmissions can be received over great distances, but the time accuracy is on the order of one millisecond.
The current NTPv4 standard includes audio drivers for WWV, WWVH, and CHU.
Longwave Broadcasting
NIST also transmits precise time and frequency on longwave radio at 60 kHz from Boulder, Colorado. There are other stations transmitting precise time signals on longwaves.
Call signs and location
Frequency (kHz)
Power (kW)
WWVB Fort Collins, Colorado, USA
60
50
DCF77 Mainflingen, Germany
77.5
30
MSF Rugby, United Kingdom
60>
50
HBG Prangins, Switzerland
75
20
JJY Fukushima, Japan
40
50
JJY Saga, Japan
60
50
Low-Frequency Standard Time Stations
The time code is transmitted through a 60-second interval at a speed of 1 b/s, just like on shortwave stations. The data transmission formats are also similar for both standards. Signal propagation occurs through the lower layers of the ionosphere, which are relatively stable and exhibit predictable daily fluctuations in height. Thanks to this predictability of the physical environment, the accuracy increases to 50 μs.

WWVB broadcast format
Geostationary operational environmental satellite
In the USA, NIST also transmits precise time and frequency data at approximately 468 MHz from geostationary operational environmental satellites (GOES). The time code alternates with messages used to poll remote sensors. It consists of 60 BCD semi-bytes transmitted at 30-second intervals. The information of the time code is similar to that of terrestrial services.
Global Positioning Systems
The U.S. Department of Defense uses GPS for precise navigation on land, at sea, and in the air. This system provides 24-hour coverage of the globe using a constellation of satellites in 12-hour orbits inclined at an angle of 55°.
The initial constellation of 24 satellites has been expanded to 31 satellites in a non-uniform configuration, ensuring that at least 6 satellites are always in sight, with 8 or more visible in most parts of the world.
Services similar to GPS are operated or planned by other countries. Russia's GLONASS has been operational for over a decade, counting from September 2, 2010, when the total number of satellites was increased to 26 — the constellation was fully deployed for complete coverage of the Earth.

GPS satellites around the globe.
The European Union's satellite navigation system is called 'Galileo.' It was expected that 'Galileo' would begin operations in 2014-2016, when all 30 planned satellites would be launched into orbit. However, by 2018, the 'Galileo' satellite constellation had not yet reached the necessary number of satellites.
There is also the Chinese "Beidou," which translates to "Big Dipper." The group, consisting of 16 satellites, was launched for commercial operation on December 27, 2012, serving as a regional positioning system. The system is expected to reach full capacity by 2020. Just today, an article was published on Habr , about the successful launch of a satellite for this system.
Mathematics of Determining Coordinates Using GNSS
How does a GPS/GLONASS navigator on your smartphone determine your location with such accuracy using the Radio Navigation Satellite System (RNSS)? To understand the calculation principles, you need to recall stereo geometry and algebra from the higher grades of high school or a physics-mathematics school.
Each satellite transmits the exact time to the receiver. Atomic clocks are installed on the satellites, so they can be trusted. Knowing the speed of light makes it easy to determine the radius of the sphere on the surface of which a satellite is located. This sphere, touching the Earth, forms a circle where the GPS / GLONASS receiver is situated.
When signals arrive from two satellites, we already have the intersection of the Earth and two spheres, which gives us only two points on a circle. Ideally, the third satellite's sphere should intersect one of these two points, definitively determining the receiver's coordinates.
In principle, even with two satellites, we can glean indirect clues to ascertain which of the two points is closer to the truth, and modern navigation software algorithms can handle this task. So why do we need a fourth satellite?

Determining Location Using Satellite Grouping.
It's easy to notice that in this idealized picture, there are many nuances that affect calculation accuracy. The time on the receiver is perhaps the most obvious source of errors. For everything to work correctly, the GPS / GLONASS receiver's time must be synchronized with the satellite's time. Without this, the error would be ∓ 100,000 km.
From the formula of speed, time, and distance S = v*t, we derive the basic equation for signal transmission in RNSS. The distance to the satellite equals the product of the speed of light and the time difference between the satellite and the receiver.

This mainly occurs because even after all the synchronizations, the time on the receiver tpr can be known with a sufficient degree of accuracy. There will always be a Δt between the true time and tpr, causing the calculation error to become unacceptable. That's why we need fourth satellite.
To provide a clearer mathematical justification for the need for four satellites, we will establish a system of equations.

To determine the four unknowns x, y, z, and Δt, the number of observations must equal or exceed the number of unknowns. This is a necessary but insufficient condition. If the normal equation matrix is degenerate, the system of equations will have no solution.
It is also important to consider the Special Theory of Relativity and the relativistic effects of time dilation on satellite atomic clocks compared to those on the ground.

If we consider that the satellite moves in an orbit at a speed of 14,000 km/h, we find a time dilation of about 7 μs (microseconds). On the other hand, relativistic effects from the General Theory of Relativity also come into play.
The matter is that satellites in orbits are at a greater distance from Earth, where the curvature of the spacetime continuum is less than on the Earth's surface due to Earth's mass. According to GTR, the rate of clocks located closer to a massive object will appear slower than those that are farther away.

- G — gravitational constant;
- M — mass of the object, in this case, Earth;
- r — distance from the center of the Earth to the satellite;
- c — speed of light.
Calculating using this formula gives a time dilation of 45 μs on the satellite. Thus, -7 μs + 45 μs = 38 μs, balancing the effects of STR and GTR.
In practical tasks for determining location using GNSS, it is also necessary to account for ionospheric and tropospheric delays. In addition, corrections of 46 ns are related to the eccentricity of 0.02 of the orbits of GPS satellites.
The ability to receive signals simultaneously from more than four GPS / GLONASS satellites allows for an even greater increase in the accuracy of the receiver's coordinate determination. This is achieved because the navigator solves a system of four equations with four unknowns.
the number of times and takes the average value, increasing the accuracy of the final assessment according to the laws of mathematical statistics.
How to configure a Stratum 1 NTP server via satellite communication
To set up a high-quality time server, you only need GPSD, NTP, and a GPS receiver with a 1PPS output (one pulse per second).
1. Install gpsd and ntpd, or gpsd and chronyd. The gpsd version should be ≥ 3.20
(1:1109)$ sudo emerge -av gpsd chrony
Local copy of remote index is up-to-date and will be used.
Calculating dependencies... done!
[binary N ] net-misc/pps-tools-0.0.20120407::gentoo 31 KiB
[binary N ] net-misc/chrony-3.5-r2::gentoo USE="adns caps cmdmon ipv6 ntp phc readline refclock rtc seccomp (-html) -libedit -pps (-selinux)" 246 KiB
[binary N ] sci-geosciences/gpsd-3.17-r3:0/23::gentoo USE="X bluetooth cxx dbus ipv6 ncurses python shm sockets udev usb -debug -latency-timing -ntp -qt5 -static -test" GPSD_PROTOCOLS="aivdm ashtech earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 navcom ntrip oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tnt tripmate tsip ublox -fury -geostar -nmea0183 -nmea2000 -passthrough" PYTHON_TARGETS="python2_7" 999 KiB
Total: 3 packages (3 new, 3 binaries), Size of downloads: 1275 KiB
Would you like to merge these packages? [Yes/No]2. Connect the GPS receiver with PPS support to a serial RS232 or USB port.
A regular cheap GPS receiver will not do; you may need to run around a bit to find a suitable one.
3. Ensure that the device is actually outputting PPS; verify the port using the gpsmon utility.
4. Open the file /etc/conf.d/gpsd and edit the following line.
Replace
GPSD_OPTIONS=""with
GPSD_OPTIONS="-n"This change is necessary for gpsd to start searching for GNSS sources immediately.
5. Start or restart gpsd.
(1:110)$ sudo /etc/init.d/gpsd start
(1:111)$ sudo /etc/init.d/gpsd restart
For distributions with systemd, use the appropriate systemctl command.
6. Check the console output of the cgps command.
You need to ensure that data is being received properly from the satellites. The console should display something similar to the illustration.

Console output of the cgps command.
7. It's time to edit the file /etc/ntp.conf.
# GPS Serial data reference (NTP0)
server 127.127.28.0
fudge 127.127.28.0 time1 0.9999 refid GPS
# GPS PPS reference (NTP1)
server 127.127.28.1 prefer
fudge 127.127.28.1 refid PPS
The upper NTP0 entry points to a universal time source available on almost all GPS devices. The lower NTP1 entry defines a much more accurate PPS source.
8. Restart ntpd.
(1:112)$ sudo /etc/init.d/ntpd restart For distributions with systemd, use the systemctl command.
$ sudo systemctl restart ntp
Materials used
- David L. Mills, The Network Time Protocol on Earth and in Space, Second Edition.
Source: habr.com
