How Computers Synchronize Their Clocks - NTP and PTP Explained

How Computers Synchronize Their Clocks - NTP and PTP Explained

Gary Explains

2 года назад

48,815 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Sad Guy
Sad Guy - 16.07.2023 14:24

So is the BIOS /UEFi Clock also synchronized via NTP? Is the OS telling the BIOS the right time?

Ответить
Samarth Tandale
Samarth Tandale - 30.12.2022 14:52

If the time taken to travel from client to server is different from server to client, then would it still give correct offset and round trip delay?

Ответить
Samarth Tandale
Samarth Tandale - 30.12.2022 14:45

Excellent Video Explanation !!!

Ответить
John Lentokone
John Lentokone - 24.10.2022 19:34

I think this video is missleading. Gary says that the accuracy of NTP is eg. 50 ms, 80 ms and PTP is better than 1 us. I think this is impossible if NTP and PTP is tested in equivalent conditions.

Ответить
Siddharth Bhattacharya
Siddharth Bhattacharya - 24.07.2022 18:04

Thanks for the wonderful video Gary. Could you care to make a video on the differences of System time between iPhone and Android devices? Any Time Sync app would show you that [once you do multiple measurements] iPhone system clock is much more accurate [ > 200 ms] than Android’s [ often off by more than 2 s ]. Even this anomaly applies to premium Android devices. I understand than Cell phones take the Date, Time and Time zone information from cell towers. Why then the iPhones would have better system time than Androids. Are iPhones also syncing to Apple NTP servers; while Androids do not.

Ответить
Alex Landherr
Alex Landherr - 23.12.2021 02:30

Stratum 0 are also ground based atomic clocks.

Ответить
Denis Vandale
Denis Vandale - 28.09.2021 01:21

Too bad Microsoft can't figure out how to sync time properly.

Ответить
Federico Jimbo Smithson
Federico Jimbo Smithson - 19.09.2021 06:06

it's basic arithmetic guys.. so simple

Ответить
Chris
Chris - 07.09.2021 15:29

there is no true time in the universe. it is merely causality, things go bump. that's why time travel is nonsense. you cant reverse causality, as it doesnt have a direction. only particles in motion due to forces. none of the (cyclical) things in the universe obey a perfect and unchanged motion forever; only mathematical (approximation) formulae do.

Ответить
Arnab Bose
Arnab Bose - 07.09.2021 02:05

Very nice video!
So, basically, NTP is really the most natural way you would device to determine the offset to apply, if you assume that the latency is symmetric between the client and the time server.
I suppose the reason for the symmetry assumption is that there's simply no way to deduce the asymmetry in the latency.

Ответить
Muhammad Hanif
Muhammad Hanif - 06.09.2021 13:47

now how do we know the delay is accurate ??

Ответить
Isaac Babji
Isaac Babji - 06.09.2021 07:52

Nice explanation Gary, Who pays the time servers?

Ответить
cmilkau
cmilkau - 05.09.2021 21:08

A graphical explanation would have been nice. I picture it like two sticks, a long one client side spanning t0 to t3 and a short one server side spanning t1 to t2. The client then adjusts its clock so the middle of both sticks align in the timeline, basically assuming the delay is the same in both directions.
The round-trip time (total time with packets inflight) is basically the time the client waited minus the time the server took, so the difference in length between the two sticks.

Ответить
st1300 r
st1300 r - 04.09.2021 17:50

Don't do too deep a dive on this we'll never see you again lol. GPS time? UTC nist? USNO? International? UTC1? Atomic? Upcoming new (optical) definition of the second? We're approaching time resolution where gravity changes from the ground to the 2nd floor changing what a second is, matters. It's a deep rabbit hole.

Ответить
Tai Dee
Tai Dee - 04.09.2021 17:13

So it’s time we talked about time 😂

Ответить
FriedEgg
FriedEgg - 03.09.2021 11:43

I think my Casio watch is a stratum 1 device. It communicates with a satellite every night to synchronise itself.

Ответить
Robert Caldwell
Robert Caldwell - 03.09.2021 09:41

t1 and t2 are unreliable due to how networks can change on-the-fly, as well as the queued-in-force for network messages. The best you can hope for is all on the clientside, the less the server has to work, the faster you get a response. This means the client saves the time as T0, and when it receives the message back, it's T3.....there is an assumption that the average round trip will be twice the length of a one-way trip, so you take (T3-T0)/2 and that's your offset from the time you receive to set. The time it takes for the response is also unimportant, as it takes time for the client to also queue the data and calculate/set the time, so it's going to be off regardless.

This formula works very well in dead-reckoning code to sync servers and clients.

Ответить
Xeridea
Xeridea - 03.09.2021 07:44

The accuracy for setting on your home computer is probably within 5ms. If your latency is 10-80ms (depends on internet), it isn't 10-80ms off, since it calculates the trip time to consider. It also sends multiple packets to work out an average. Assuming your jitter isn't bad, it may even be within 1-2ms.

Ответить
FMphoto Office
FMphoto Office - 03.09.2021 05:26

Some countries have a 30 minute offset.

Ответить
Michael B
Michael B - 03.09.2021 04:13

Hopefully you can do a video on that open access atomic clock project that is spooling up for PCs and explain its advantages in certain circumstances. Linus showed it of but didn't really explain how a prosumer or small business could benefit from it properly, really only how big data, banks, social media etc can benefit.
Believe it has an open source? Any way open access board plan which you can get a board manufacturer to make plus an atomic clock costing around 2,000$ plus the open source software to send timing signals to other PCs, single board PCE is the core of the hardware, you can synchronize computers on your network to a couple of nanoseconds rather than the milliseconds the current (baseline) software system does now software only. Plus it can grab it's master time (GMT etc) from one of the government clocks. IE UK or EU or USA etc all have these master clocks, then it will carry-on internally with minimal drift, correcting drift or leap seconds from the master clock as needed.

Ответить
J H
J H - 03.09.2021 03:27

Some of the time signal formats are poorly conceived. IIRC, WWVB (maybe GPS too?) only tells you the time after the top of the unit (minute, second). So the SW has to read in the date-time string, increment it by one unit, and then await the next unit pulse. I may be remembering some of this wrong; apologies in advance

Ответить
J H
J H - 03.09.2021 03:07

I have a 'radio controlled' wall clock, one of the very nice ones (UltrAtomic) using the newer PSK WWVB signal. Then I got a 2nd one and hung it up right next to the first, just so that I could enjoy their synchronicity. Typically they're within a very small fraction of a second, and tick in seemingly-perfect synchronization, which is strangely satisfying. Not bad radio performance for about 3400 km from the transmitter site near Fort Collins CO.

Ответить
Kungsholmen
Kungsholmen - 03.09.2021 00:52

Many routers run NTP servers

Ответить
Lotus_Flowerrr
Lotus_Flowerrr - 03.09.2021 00:41

:) thank you!

Ответить
SwissPGO
SwissPGO - 03.09.2021 00:38

Hi Gary, I think there is a misrepresentation of stratum 0. If I understand you correctly, you represent statum 0 as the gps satellites, and that the stratum 1 servers obtain their time from those satellites. This is in my opinion incorrect: a stratum 1 server needs direct connection to the atomic clock, and it cannot rely on satellites as the timing signals from those satellites is impacted also by atmospheric conditions, clouds, air pressure etc... Each stratum 1 server is sitting really close to its atomic clock, and gets his time from these devices directly.

Ответить
João Ribeiro
João Ribeiro - 02.09.2021 23:10

please don't start making powerpoint stile videos. It's very annoying because I read it faster than you say it so I tend to pause the video, read it and then pass to the next slide so to speak. I like the usual format better

Ответить
A Karim Siddiqui
A Karim Siddiqui - 02.09.2021 22:57

Gary uses OnePlus

Ответить
Amos Reginald Jr.
Amos Reginald Jr. - 02.09.2021 22:28

This is a channel that I would love to watch to pass time when I was 13.
I’m 19 now and I’m very happy I came across it because now that I’m older I can understand the information provided

Ответить
Darin755
Darin755 - 02.09.2021 22:17

I'm going to put a atom click in my pc

Ответить
ed
ed - 02.09.2021 22:05

My computer doesn't ask. Or, more correctly, Windows 10 doesn't ask. I always have to update it via manual sync, even though it is set to auto sync. On Linux, it's always correct.

Ответить
Duane Dsilva
Duane Dsilva - 02.09.2021 21:42

Please do a detailed video on how PTP works, and its usecases

Ответить
Perhaps
Perhaps - 02.09.2021 20:40

How does Stratum 0 determine the time?
Whatever the master clock is... how does that clock maintain its time, with accuracy down to the millisecond?

A few years ago, I heard that aircraft carriers need timing accuracy down to the billionth of a second, in order to safely land airplanes on its deck.
Do you know if that is true, and how they keep such accurate clocks?

Ответить
Lexitivium
Lexitivium - 02.09.2021 20:30

Where can I get one of those Gary Nest Hubs..? "Hey, Gary!" ;-)

Ответить
Félix A.G
Félix A.G - 02.09.2021 20:16

Like.

Ответить
Greg
Greg - 02.09.2021 18:08

NSW Australia are gold standard

Great video btw!

Ответить
Peter Mainwaring
Peter Mainwaring - 02.09.2021 18:01

If I've read it right, the assumption is that the delay is the same both ways?

Ответить
whatever
whatever - 02.09.2021 17:03

is it reasonable to assume that the delay of a one-way trip is exactly twice that of the two-way trip?

Ответить
MegasXLR
MegasXLR - 02.09.2021 16:31

The only Stratum I know is the car from GTA lmao

Ответить
Johnnie Hougaard Nielsen
Johnnie Hougaard Nielsen - 02.09.2021 16:09

I'm also running a local NTP server on my network (on a machine doing other things too). One reason for that was to avoid my IoT devices (ESP8266 or ESP32) asking the public NTP servers for real time, instead getting synchronization from my local NTP server. Of course, my local server will synchronize with a public server, and in case of an outage, my IoT devices (running Tasmota) can also fall back to public NTP servers. Some home "routers" will do a similar thing to reduce network traffic.

Ответить
Piiu Mlkj
Piiu Mlkj - 02.09.2021 16:00

So basically NTP is just averaging the travel time of each leg of the trip , it assumes that they are equal , but if they are not ; it loses accuracy. I did the calculation and put different numbers for the time it took for the signal to get from the server to the client ( i assumed it to be 7 seconds ) and the result was 2.5 seconds off the correct time . Not that impressive !

Ответить
Hans Isbrücker
Hans Isbrücker - 02.09.2021 15:28

Why doesn't my phone use GPS to get the time when I have that switched on? 🤔

Ответить
Damian Anlauf
Damian Anlauf - 02.09.2021 15:25

The skit at the start reminds me of Vault 103 in Fallout 3. You know, the one with the Gary clones.

Ответить
S
S - 02.09.2021 15:21

My Sony DAB+ clock radio is only 2 seconds slow to atomic time. Apparently, time syncing to the radio station only takes place when the DAB+ radio function is used. Otherwise, the internal quartz clock is in effect, which is drift just like any other clock. So, briefly listen to DAB+ radio every so often to keep the clock accurate.

Ответить