1. Current Location: Home >  Router Encyclopedia >  The phone time is correct; when the router loses power, it resets to zero. Packet capture depends on NTP timing

The phone time is correct; when the router loses power, it resets to zero. Packet capture depends on NTP timing

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

Last month, I repaired that timed disconnection router at my mom's house that wouldn't run. 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 article where I < a href="https://www.shunot.com/en/192-168-1-1/924.html"> the router time was incorrect. My mom was watching from the side and casually asked, "Why does that phone never use a person to check the watch?"

That one sentence left me speechless. 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.

Let's be clear: three types of devices, three ways to live

.

Compare your phone, computer, and router side by side, and the answer becomes clear—the difference lies in whether someone is keeping a watch for it.

The 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.

Routers are 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 , ? base does not reset
the device loses powerwhat timing is relied upon
The phone does not reset (base station + network double insurance),station NITZ push + NTP
the computer (button battery with RTC).Motherboard RTC + Windows Time
When routers reset to zero, since 1970, NTP has been the only
lifeline

NTP is just a phone call asking for time, and the packet is ridiculously

small. To put it bluntly, NTP sets a unified format for 'asking what time it is now': using UDP port 123—yes, just like DNS queries, using UDP, small packets for Q&A, no connection needed. This part is < a href="https://www.shunot.com/en/lybk/1076.html" > the TCP and UDP articleI explained why using UDP is cost-effective in the 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 the return bag? I asked Alibaba, Tencent, and the National Time Service Center about each company, and the data was laid out:

time :
Server-level (stratum) round-tripstandard offset
ntp.tencent.com266.7ms - 0.1ms
ntp.aliyun.com254.6ms + 8.2ms
ntp.ntsc.ac.cn3 (another check found 4): 136.5ms + 22.0ms

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 is Stratum 0, atomic clocks, GPS satellite clocks—accurate and accurate, but they don't directly serve external users, fearing they might fail. 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.

Here's a counterintuitive thing. 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.

By the way, here's 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 need to worry about phones: the base station is in the sky, check 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 real cases of time drift come from two types: WiFi tablets without SIM cards, and old phones that have been used for seven or eight years—internal crystal oscillators that can drift out for dozens of seconds a day, and that's when it's NTP's turn. 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 a router 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 the phone—only after finishing did it come to the time-setting step—I had < the > article about six things to do when starting the router at href="https://www.shunot.com/en/lybk/1145.html", and the time-setting 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 off, and the problem isn't just

about scheduling.

Messy scheduling and tasks are the easiest to spot. During the days my router reset to zero, there was another

thread:

All logs were ruined. To troubleshoot for network disconnections, check the log. The log's "disconnect at 3 a.m." actually happened to be in the afternoon. Following the logs to find patterns can get you involved. The scheduled restarts also shifted along with the execution times, and I have suffered losses in these situations.

Even more concealed 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 difference between HTTP and https. Timestamps are one of the lifelines of a certificate.

There is also the parents' scheduled internet disconnection. My cousin's child's router had a 20-minute time loop. The 9:30 disconnection didn't execute the time, 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 these settings one by one in the article WiFi timer switch.

Which three should you fill in at home? Let's talk about the actual test

.

Here's the conclusion first: ntp.aliyun.com, ntp.tencent.com, ntp.ntsc.ac.cn—fill in all three, don't hang just one.

Let's speak based on 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 one unsolvable situation, 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.

Wrap up with an order. If the router time is incorrect, first check the backend to confirm that the NTP server is filled in by the three settings above (the settings entry for each brand can be found in the article on how to adjust the incorrect 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.

? Scheduled . Time . , . If
What should you do in the scenario
tasks don't run at midnight. Check the system time in the background, 90% reset to zero. Check the NTP server
floats for a few minutesNTP server is outdated and ineffective. Switch to Alibaba or Tencent
If the company network environment doesn't matchUDP 123 may get jammed and there's no solution. Don't blame the router
the router changes to a new NTP setting and doesn'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 time is correct; when the router loses power, it resets to zero. Packet capture depends on NTP timing》
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