 |
|
 |
I have testing my program by your source.
I found the strange year with 1940' instead of 2010'.
I want to your comment.
|
|
|
|
 |
|
 |
I solved a problem
Thankyou!
|
|
|
|
 |
|
 |
Hi all,
Many thanks to Ahmet Orkun GEDiK!
This piece of code was 99% of what I was looking for.
I turned it to a dialog app, and put the time sync routine in a separate thread (thanks to J.Newcomer), and thought it could maybe be of some interest to others, so here it is :
http://www.foretrade.com/downloads/time.zip
It includes VC.NET project files, as well as the executable.
Regards,
Bruno V
|
|
|
|
 |
|
 |
I don't know if I'm just being thick-headed, or what, but I just can't seem to get this to go for me. All I really want to do is be able to time and date stamp with the current time and date. Is there a simple line of code that I can just throw into my program? Any help is greatly appreciated.
|
|
|
|
 |
|
 |
You've way to do it by use daytime 13/tcp service without any development. Unfortunately, you have to calculate date value by RFC868 protocol. Please take a look http://www.faqs.org/rfcs/rfc868.html .
Thank you.
Orkun GEDiK
|
|
|
|
 |
|
 |
May I ask why you didn't post a complete workspace for your project? I have been programming my own time server and time client and your code definitely interests me. I can't get it to compile and the example does work on my system. I did a little investigating and I think Windows 2000/NT requires AdjustTokenPrivileges to be able to change the system clock, which maybe why it doesn't appear to modify my systems time.
Could you post a complete workspace?
Nate
You can kill the revolutionary, but you can't kill the Revolution. (RATM & TOOL)
|
|
|
|
 |
|
 |
go to http://bilmuh.ege.edu.tr/~oged/timeclient/source/timeclient_src.zip for complete workspace.
Thanks...
|
|
|
|
 |
|
 |
This is very cool and so simple.
Thanks,
Nate
You can kill the revolutionary, but you can't kill the Revolution. (RATM & TOOL)
|
|
|
|
 |
|
 |
You have a slight bug in your code which is very common in socket programming.
The Receive call does not necessarily read the number of bytes you passed in as your buffer size, but reads however many bytes are available, at most that many bytes.
While in this example it's not likely that the 4 bytes wont be read as a single receive, if the server chose to send each byte with a separate Write, it's at least possible they will be received as 4 separate one byte reads.
You need to check how many bytes the Receive actually read and possibly loop if you wanted more.
|
|
|
|
 |
|
 |
Yes, you are right. Thank you for information.
|
|
|
|
 |
|
 |
I've just used your exe as follow:
settime time.nist.gov
and the result:
Time as set from time.nist.gov
Only one problem, date is 02.07.2036 and time 07:29
none of elements is correct...
on a W2000 SP2 Italian.
|
|
|
|
 |
|
 |
Yes you'r right. But there's something wrong at time.nist.gov.
Use time.ien.it time server instead of time.nist.gov
Thank you.
|
|
|
|
 |
|
 |
A good example, there is a list of public timeservers:
http://www.eecis.udel.edu/~mills/ntp/clock1.htm
|
|
|
|
 |
|
 |
Primary - http://www.eecis.udel.edu/~mills/ntp/clock1a.html
Secondary - http://www.eecis.udel.edu/~mills/ntp/clock2a.html
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
 |
|
 |
Thanks for this example. It worked for me.
|
|
|
|
 |
|
 |
Thank you for your interest.
Ahmet Orkun GEDiK
Technical Consultant
ASTRON Project Office
|
|
|
|
 |
|
 |
I just recently read this RFC, and you basically cut and paste the entire RFC here. How about using your own words?
|
|
|
|
 |
|
 |
I have written openly in my words. (notes pasted from http://www.faqs.org/rfcs/rfc868.html). That means, i am not a document thief. I don't want to play with words. Waste of time.
No words, just work. Take a look source code.
Thanx.
|
|
|
|
 |
|
 |
The interest of the work of Orkun GEDiK is very big for me. He has found the RFC, cut and paste it here (while reinvent this wheel?), put it together with CSocket, and very simply shown that it is possible to simply program a socket. Now I feel ready to go more deeply if needed.
More over the settime program is very useful in itself.
Thank you Orkun
Pierre Couderc
Pierre Couderc
|
|
|
|
 |
|
 |
This is an example. Don't forget.
|
|
|
|
 |