ccrtp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ccrtp-devel] NTP_EPOCH_OFFSET off one hour


From: Martin Runge
Subject: [Ccrtp-devel] NTP_EPOCH_OFFSET off one hour
Date: Sun, 6 Jan 2008 16:58:30 +0100
User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)

Hi everybody on the list,

I think the NTP_EPOCH_OFFSET in private.h has 3600 seconds too much. 3600 s == 
1 hour, so it looks like a timezone problem, but it isn't.

I verified it in two ways:

1)
from the leap seconds file from http://www.cis.udel.edu/~mills/leap.html 
2272060800      10      # 1 Jan 1972
says Jan, 1st 1972 had 2272060800 seconds passed since 1.1.1900 00:00:00h

1972 was a leap year, so 1970 and 1971 both had 365 days and therefore

2* 365 * 24 *3600 seconds = 6307200 seconds

2208992400 + 6307200 = 2272064400
that is 3600 s (==1 hour) more than in the leap seconds file.

2)
boost_date_time:
long h = now.tv_sec / 3600;
long s = now.tv_sec % 3600;
long m = s / 60;
s = s % 60;
unsigned us = now.tv_usec;
    
boost::posix_time::time_duration td(hours(h) 
                                                             + minutes(m) 
                                                             + seconds(s) 
                                                             + microsec(us));
  
boost::posix_time::ptime boost_time;
boost_time = ptime(boost::gregorian::date(1970, Jan, 1), td); 

cerr << "Boost Time: " << boost_time << endl;

=> shows exactly the result I would expect from the NTP offset in the leap 
seconds file.

best regards
Martin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]