1. Current Location: Home >  Router Encyclopedia >  The phone never misses time; does the router reset to zero as soon as the power goes out? What's going on with NTP Sync Times? I sent a package to take a look

The phone never misses time; does the router reset to zero as soon as the power goes out? What's going on with NTP Sync Times? I sent a package to take a look

NTP timing principle: The timing methods of three devices—mobile phones, computers, routers—are compared and layered with the NTP server stratum

Last month,

repaired a router at my mom's house that didn't execute due to scheduled disconnection. The root cause was that after the power outage, the system time reset to zero. The 8:30 scheduled task was calculated as 1970. I wrote about the whole process in the about router time mismatched. My mom was watching from the side and casually asked, "Why does that phone never use a person to check the watch?"

just that one sentence stumped me. Yes, just insert a SIM card and you'll have time; airplane mode and WiFi will also have time. Ten years without seeing anyone, no phone has missed time. The router loses power and you lose your memory; the computer runs for three years after unplugging. Why is there such a big difference between the same electronic products? When I got home, I broke down the whole story from start to finish and even sent a few packages myself to see how it was timed.

to clarify first: three devices, three ways to live

Compare phones, computers, and routers side by side, and the answer is — the difference lies in whether someone is keeping a watch for it.

phone is the most comfortable. When the card is inserted, the base station will directly push down the date and time through the cellular control channel. This feature is called NITZ, a free gift from the carrier. Even if your phone has no data or no calls, you can receive it as long as you're on the network. When connecting WiFi, the phone will run NTP checks again, so the two insurance sets cover each other.

computers rely on hardware. The motherboard features a CR2032 button battery and a timekeeping chip, officially named RTC, which is a real-time clock. When the machine is powered off and unplugged, the battery continues to supply the chip and time, so the computer is left unturned on for half a year. The startup timing is still correct. After the system boots up, the built-in Windows Time service regularly calibrates the time.windows.com to correct the slight drift that comes out of the battery.

router is the worst. They cut costs aggressively: no batteries, no timing chips, and memory runs out whenever the power is cut off. At the moment of powering on, it didn't even know what year or month it was, relying entirely on the NTP to pull it back after networking. My old AC2100 was upgraded to an IoT private network AP, and that's exactly how it is—if you cut off the power and try again, the backend log time starts directly from midnight.

After
device power outage what time is relying on to keep the time accurate
the phone does not reset to zero (base station + network double insurance) Base station NITZ push + NTP
computer not reset (button battery with RTC) motherboard RTC + Windows Time
Router reset to zero, and since 1970 NTP has been the only lifeline

NTP is just a call asking about the time. The packet is ridiculously small

NTP basically a unified format for "asking what time it is now," using UDP port 123—yes, just like DNS queries, using UDP. The packet asks and answers one answer, no connection needed. This was explained in the TCP and UDP why UDP is cost-effective for small Q&A.

I wrote a few lines in Python and sent one myself. The request packet has 48 bytes. Interestingly, only the first byte is a contented 0x1B; the remaining 47 bytes are all zero. Three things are packed into this one byte—version number 3, I am a client, please reply to me. The server received it and returned a 48-byte packet with the exact time at that moment. What can you see in

bag back? I asked Alibaba, Tencent, and the National Time Service Center about each company, and the data was laid out:

HTML77__2HTML101__+22.0ms
Server stratum round-trip time standard offset
ntp.tencent.com66.7ms-0.1ms
ntp.aliyun.com254.6ms+8.2ms
ntp.ntsc.ac.cn3 (Found 4 on another search)136.5ms

offset is "how much faster it is than me." Tencent's device is almost identical to my local clock, Alibaba's is just over 8 milliseconds. You can't even tell the difference by a watch, so it doesn't matter. But the "round-trip time" column has its own details—the journey takes tens of milliseconds, so how does the meter know how much of the error is the travel fee? NTP's algorithm is clever: one moment is recorded when a request is sent, one each is recorded when the server receives and is replied to, and another is recorded when it returns to the local site. After subtracting four moments, half is shared between outbound and return trips, so travel costs are deducted. This is the confidence that it can handle millisecond-level responses.

time also has a family tree: stratum layering

the stratum field in the return packet means "how many layers apart from the clock" in this time chain. At the top of

is Stratum 0, atomic clocks, and GPS satellite clocks—accurate and accurate, but they don't directly serve external parties, fearing they might be asked. The server that directly matches time with them is Stratum 1, and time centers and major institutions in various countries maintain these machines. Next, those asking Stratum 1 for time are Stratum 2—Alibaba and Tencent's public NTP tests show 2. After asking Alibaba about your router, you get Stratum 3, and if you pair your devices with the router, it's Stratum 4.

There's a counterintuitive thing here. For the public NTP at the National Time Center, I tested it and got Stratum 3, and another time I found 4—many people's first reaction was, 'The National Center should be 1.' It's not that it can't do it, but the public query traffic is too high. The data center has several layers of distribution before the actual clock, and you're asking about the outer layers. There's an even more interesting field in the package: the time the server last matched upstream. Alibaba's unit replied to me at 02:38:46, just a few minutes before I checked — it didn't watch the atomic clock every day, but would set it up every so often, usually holding up the local clock.

a fun fact. NTP timestamps are not counted from 1970 onward; they are 1900, 70 years earlier than the Unix era. And the seconds column only has 32 digits; 2 to the 32nd power of the second equals about 136 years—meaning February 2036 will be the end of the page. The new standard has been updated, but no one can say what mistakes old equipment and firmware might make when the time comes. Additionally, the decimal column has 32 bits, which can represent 0.23 nanoseconds. The clock can read nanoseconds, but the road takes tens of milliseconds. The accuracy bottleneck is always on the road, not on the watch.

Why don't you worry about

phones: the base station is in the sky to match the meter

back to my mom's question. Just insert the SIM card on your phone and you'll have time, thanks to the NITZ mentioned above—the carrier's base station broadcast channel already includes the date and time. When your phone turns on and you find the network, you can easily align the meter without needing to drive any data. That's why senior phones and feature phones don't have WiFi or NTP, yet the timing is still accurate.

the two types of time drift you really encounter: WiFi tablets without SIM cards, and old phones that have been used for seven or eight years—the internal crystal oscillator is aging and can drift out for dozens of seconds a day, and that's when NTP gets to step in. Android's "Auto-set date and time" switch uses NITZ when inserting the card and NTP when connecting WiFi; only when both ends are disconnected is it stopped. Why can

routers be restored after being reset to zero? Relying on the last few steps of the startup process. Powering on for self-check, reading configuration, turning on WiFi, dialing up — after all done, it was time to set the time—I had the about six things to do when starting the router, and the timing was exactly the slowest of the six. So after a power outage and reboot, for one or two minutes, the background time still freezes at 1970. If you immediately check the timing rules during this time, all you see is the illusion of "no effect," just wait.

the timing is wrong, and the problem isn't just about scheduling

Messy scheduled tasks are the easiest to notice. During the days my router reset to zero, there was another thread:

logs were completely ruined. To troubleshoot for network disconnections, check logs. The logs record 'disconnected at 3 a.m.' The actual time might be afternoon. Checking the logs for patterns can get you tangled up. The scheduled restarts also shifted along with the execution times, and I have suffered losses in these situations.

more covert are the certificates. HTTPS certificates have validity and expiration times. If the device system time is absurdly wrong—for example, stuck in 1970—browsers and apps will consider the certificate "not yet valid" and directly refuse to connect. The internet is clearly connected, but no matter what, it just won't open. Many people treat this as a network disconnection fix, checking lines and DNS and going through all the trouble. I wrote about transmission encryption in the on the differences between http and https; timestamps are one of the lifelines of a certificate.

also parents disconnect regularly from the internet. My cousin's child's router had a 20-minute time loop. The 9:30 disconnection didn't work, and the child played for another twenty minutes before it was discovered—Mercury and Tengda's parental controls and WiFi timer switches all consume system time. I've listed all these settings in the WiFi timer switch article.

which three should you fill in at home?

actual test, the conclusion is to first fill in :ntp.aliyun.com, ntp.tencent.com, and ntp.ntsc.ac.cn—fill in all three, don't just hang one.

speak according to actual data. Tencent has minimal offset and stable layers; Alibaba is the fastest; Although the Timing Center is a bit farther away and deeper, it is the national team and is kept as a third leg. Don't try to fill time.windows.com for flashy looks—I tested the round trip in just over 130 milliseconds, and with just over two years left until 2036, I'm not sure about it. Not to mention the common pool.ntp.org in tutorials, which are random foreign node pools. Domestic access is sometimes unavailable, and Tengda routers default to this type. I'll mark this in the time section about scamming me.

there's a situation that can't be solved, so let me clarify in advance: NTP runs UDP 123. Some companies' networks cut UDP traffic down to just 53 and 443. In this environment, if the router doesn't match, it's not the router's fault—it's the route being blocked. Fortunately, home broadband doesn't do that.

give an order for wrapping up. If the router time is incorrect, first check the backend to confirm that the NTP server is filled in the three settings above (the settings entry for each brand are in the on how to adjust the time); Still not correct, check if the firmware is so old that it doesn't have an auto-timing option; If none of that works, manually set the time again to save the moment—but remember, manual setting only sets the meter correctly; power outages will reset to zero, so the NTP still needs to work.

scenario what should I do
scheduled tasks don't run at midnight check system time in the background, 90% reset to zero, check NTP servers
time drifted for a few minutesNTP servers are outdated, and if you switch to Alibaba or Tencent,
company network environment doesn't matchUDP 123 might get jammed, no solution, don't blame the router
router is replaced with a new NTP settings and don't migrate, the new device needs to be re-entered
Read More


Copyright Notice Scan to read on mobile
All Rights Reserved: 《SHUNOT》 => 《The phone never misses time; does the router reset to zero as soon as the power goes out? What's going on with NTP Sync Times? I sent a package to take a look》
Article URL: https://www.shunot.com/en/lybk/1187.html
Unless otherwise stated, all articles are original by 《SHUNOT》. Reposting is welcome! Please indicate the original URL when reposting, thank you.

Contact Us

Online Consultation: Click here to send me a message

WeChat ID: master_135

Scan to follow