[ntp:questions] Re: Calculating NTP timestamp in C program

Hans Aberg haberg at math.su.se
Tue Jul 25 10:54:12 UTC 2006


In article <clcm-20060710-0005 at plethora.net>, bg_ie at yahoo.com wrote:

> 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;
> 
> How might I calculate the fraction part?

Perhaps
  http://en.wikipedia.org/wiki/Network_Time_Protocol
can be of some help.

-- 
  Hans Aberg
-- 
comp.lang.c.moderated - moderation address: clcm at plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line.  Sorry.




More information about the questions mailing list