473,320 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

SNTP -> 64Bit TimeStamp Format

Plater
7,872 Expert 4TB
So I have been working with the SNTP protocol (RFC4330)

And it is saying that the timestamp format of 64bits is:
Expand|Select|Wrap|Line Numbers
  1. .                          1                   2                   3
  2.        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  3.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4.       |                           Seconds                             |
  5.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  6.       |                  Seconds Fraction (0-padded)                  |
  7.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  8.  
Being that the first 32bits represent whole seconds from their epoch: 0h Jan 1, 1990.

That seems all well and good. BUT I am sending a request to a NIST server and getting back what should be correct responses. However their seconds values don't seem to match up:

Here is some sample output:
Expand|Select|Wrap|Line Numbers
  1. Should get roughly(in some order): 50 EC 25 21 00 00 00 00
  2. (UDP RETURN LENGTH: 48 Bytes)
  3. LI: no warning
  4. VN: 4
  5. MODE: server
  6. STRATUM: primary reference (e.g., synchronized by radio clock)
  7. POLL INTERVAL: 2^(0) = 1
  8. PRECISION: 2^(226) = -9223372036854775808
  9. ROOTDELAY: 0
  10. ROOTDISPERSION: 0
  11. REFERENCEID: ACTS
  12.  
  13. //This would be the timestamps, given in-order as HEX bytes
  14. //So the first 4 HEX bytes should be similar to my guessed value above
  15. Reference TimeStamp: CA 6F 40 8D 4F 4C 68 B0
  16. Originate TimeStamp: 00 00 00 00 00 00 00 00
  17. Receive TimeStamp: CA 6F 40 93 B7 DC C1 C8
  18. Transmit TimeStamp: CA 6F 40 93 B7 DD CC F1
  19.  

As you can see:
CA 6F 40 xx varies by a total of 6 seconds...but none of those values, as seconds, comes anywhere near the current date and time (I'm talking off by many years, not just minutes or so)


Does anyone know a good way to interpret the 64Bit TimeStamp? This seems silly that it doesn't work out nicely.
Aug 16 '07 #1
5 6024
JosAH
11,448 Expert 8TB
Does anyone know a good way to interpret the 64Bit TimeStamp? This seems silly that it doesn't work out nicely.
The epoch is at 0h 1/01/1900. The ca6f408d value makes sense then.

kind regards,

Jos
Aug 17 '07 #2
Plater
7,872 Expert 4TB
The epoch is at 0h 1/01/1900. The ca6f408d value makes sense then.

kind regards,

Jos
Hahaha, I just looked and I did finger slip the 1990 in code and not 1900. I'll see how that goes.
Aug 17 '07 #3
JosAH
11,448 Expert 8TB
Hahaha, I just looked and I did finger slip the 1990 in code and not 1900. I'll see how that goes.
Don't you hate those typos? I do, I detest them; they can take up hours of
searching and debugging; it's Murphy to the max.

kind regards,

Jos
Aug 17 '07 #4
Plater
7,872 Expert 4TB
Yeah, that worked.
I ended up making a TimeStamp class to handle converting all the seconds to date/times (and to localtime vs utc)

Now I just need to figure out all the other mess (like why my poll interval is "2^0=1" when the minimum value is like supposed to be "2^4=16")
Edit: It appears to be returning whatever value I give it, all well
Aug 17 '07 #5
JosAH
11,448 Expert 8TB
Yeah, that worked.
I ended up making a TimeStamp class to handle converting all the seconds to date/times (and to localtime vs utc)

Now I just need to figure out all the other mess (like why my poll interval is "2^0=1" when the minimum value is like supposed to be "2^4=16")
Edit: It appears to be returning whatever value I give it, all well
My understanding was/is that the poll interval value is only meaningful in messages
*between* sntp servers ... so (I think) it can safely be ignored being a client
of such a server.

kind regards,

Jos
Aug 17 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
7
by: AlexM | last post by:
Hello All, Is there any way to pull the date via SNTP from a timeserver with ASP / VBscript? Thank you, Alex
0
by: Rahmi Acar | last post by:
can some one help me to link net connectivity into a simpe demo program. or do any one know such code.. i would be very greatfull. The idea is almost the same as writing a internet browser from...
2
by: 4Space | last post by:
Anyone know where I can find an NTP server in C#?? Sort of an open source tutorial type thing. Cheers
17
by: MLH | last post by:
After running the following code snippet... MyURL = "http://tycho.usno.navy.mil/what.html" msXML.Open "GET", MyURL, False msXML.send I would like to execute code to perform essentially what...
8
by: MLH | last post by:
I wrote a letter to NIST in Boulder, Colorado asking how to glean time/date from their servers from inside an Access 97 app and VBA. Their reply is shown below. Trouble is, I do not know how to do...
6
by: Paul Fi | last post by:
i have little knowledge of socket programming, but what i know is that using sockets we exchange text between endpoints of the socket but first we convert the text to array of bytes and we send it...
17
by: Franc Zabkar | last post by:
My D-Link DSL-302G modem/router has a real-time clock whose settings are volatile. To avoid hand keying the date/time via the modem's JS interface, I wonder if there is a way to copy the JS code to...
6
by: Seth Bourne | last post by:
Lets say i've 2 table. Order and OrderDetail. Order table is contain OrderNo(PK), OrderName. orderDetail contain orderDetailID(PK), OrderNo(FK), item and qty. and i had finish related the two...
0
by: =?Utf-8?B?RHVhcnRlIFNpbHZh?= | last post by:
Hi, I am trying to put one pc with win200 syncronized with an WinXp PC and I have set the SNTP Server with the IP, i make "querysntp" and gives the correct IP. I stop the service and I start it...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.