![]() |
|
Be sure to consult RFC: 868 for details on what it is that a time server sends you. It is not the same thing as your local time.The function
ctimeconverts an integer-based time into a string. It automatically handles time-zone information rendering Optional Extension 1 trivial. I will leave it to you to consult the RFC for the simple conversion which you must perform so as to get the correct local time on your machine.As with many network services, not all hosts provide this service. www.cs.purdue.edu does offer time service.
The layout of the timeval struct can be found in
/usr/include/sys/time.hon Solaris machines and in/usr/include/linux/time.hin Redhat Linux (7.2).If you are working on a Linux box, David Vos suggests setting the
SO_RCVTIMEOsocket option passing in the address of atimevalstruct as the option data. Ifrecvfromtimes out, it will returnEAGAIN(defined inerrno.h. This will not work in Solaris.
This site is maintained by by W. David Laverell of the Computer Science Department at Calvin College.
For assistance or corrections, please contact him at lave@calvin.edu.