Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to ping an atomic clock to set system time? 2

Status
Not open for further replies.

RebeccaLynn

Programmer
Nov 17, 2003
250
US
I have a small clock app I did, and want to add the ability to ping an atomic clock and update the system time. The only thing I am having trouble with is finding out how to ping the clock.


Becca

Somtimes, the easy answer is the hardest to find. :)

Still under construction ...
 
I already have a free program that sets the time on my system, however I want to add that ability to a program I wrote.

I know how to set the system clock, no problem, but I have no idea how to ping an atomic clock from vb.net so my app can do the same thing.


Becca

Somtimes, the easy answer is the hardest to find. :)

Still under construction ...
 
You are probably going to have to get down to the nitty gritty of sending packets with sockets if you want to do it all your self. You can do this by building your own tcp packet with a byte array and then using the socket objects to send it. I wrote a ping program to do send out icmp requests this way. It was a fairly envolved task. I think it was around 500 lines of code once it was all said and done. You would think .net would have some easy to use ping classes. You will need to find out exactly what information the atomic clock wants and what format it should be in.

This the source code that I used as a template for my ping module.

 
RebeccaLynn -

To do this correctly is more complicated that most people realize. If you just want to set your clock, be aware that if your machine is a member of an Active Directory domain, the clock will be set automatically.

If you're not on a AD domain, then there are various free SNTP (simple network time protocol) utilities out there.

Also be aware that time servers on the Internet are divided into various Strata. Strata 0 are the time servers themselves (NIST, Naval observatory, etc.). Strata 1 are one hop away, and are run by major corporations and large universities. Strata 2 servers are run by major ISPs and smaller universities. Strata 3 & 4 are run by everyone else. Strata 0 and 1 are by invitation only -- your request will be denied if you try and connect to them. Strata 2 *may* be open to the public. RedHat runs a public SNTP server at clock.redhat.com that you should be able to connect to.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Semi off the topic... Is there any way I can set my 2000 Server to get the correct time? I know it sends the time down to all the PC's, but if it's not correct, then...

Where or how do I do this? Is there something from M$ that does this?
 
Bigfoot -

Good. Please let me know how it works for you - I love that app - for the reasons I mentioned above.

Lazer
 
Thanks for all the reply's I think this task is beyond my abilities at present. I'll just have to wait untill I can progress a bit more.

Thanks again :)


Becca

Somtimes, the easy answer is the hardest to find. :)

Still under construction ...
 
> Semi off the topic... Is there any way I can set my 2000 Server to get the correct time? I know it sends the time down to all the PC's, but if it's not correct, then... <

Take a look at the NET TIME command (on Windows Advanced Server). You can point it at a SNTP server.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top