[EMAIL PROTECTED] wrote: > Hi, > > I wish to write a C program which obtains the system time and hence > uses this time to print out its ntp equivalent. > > Am I right in saying that the following is correct for the seconds part > of the ntp time? > > long int ntp.seconds = time(NULL) + 2208988800;
The add will probably overflow. So you should write this as: unsigned int seconds=time(NULL); seconds+=2208988800u; > How might I calculate the fraction part? You can't without using some function that gives you the system time with an accuracy to more than a second. Look at functions like 'gettimeofday'. DS _______________________________________________ questions mailing list [email protected] https://lists.ntp.isc.org/mailman/listinfo/questions
