top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Convert NTP timestamp from NTP packet to System time and date format

+6 votes
1,273 views

I want to write NTP client which sends and receives NTP packet to NTP server and should read the value from one of the four offsets and convert it to user readable local or GMT time format, I specifically want to know which offsets should I read in order to get correct timestamp from the packet.

Any suggestions?

posted Jan 30, 2014 by Luv Kumar

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button
Any time you're looking at network protocols, the one obvious place to look is the RFCs. Just do a web search for 'rfc ntp' to find the relevant ones. In my case, the search results pulled up a couple of good-looking hits from ietf.org,  plus the Wikipedia article for NTP, with a section "Relevant RFCs", which would make good reading.
Maybe this lib is of interest to you:

https://pypi.python.org/pypi/ntplib/

It does all the NTP stuff for you. If you want to implement that stuff by yourself just take a look at the code of ntplib, it should explain what you want.

Similar Questions
+1 vote

I would like to sync my CentOS 6.3 hardware clock time to my NTP server's time. Can I do that without reboot the hosts?

Does anyone has the steps to do that?

+3 votes

How to set up timing if NTP was block by ISP? I have try many way such as link the timezone , getting from the hardware clock. However, it is not the solution.

Please advice.

+4 votes

I am running Fedora 20 x86_64. Its on a private network not connected to the Internet, and with no NTP server. When I shut down the machine, it pauses for more than a minute at a stop job is running for NTP client/server. I dont think I enabled NTP when I installed it, but Ive done

systemctl disable ntpd.service 

and the same for ntpdate and sntp, but it still pauses for that stop job. Why is it doing that, and what can I do to make it skip that?

+2 votes

When there is a need to update our machine time, we use NTP update. Is there any public NTP server available which can serve all the requests coming from clients located around the globe ? Or Is a dedicated NTP server required for each geographical location ?

...