[ntp:questions] Understanding MJD in NTPv4 test cases

David L. Mills mills at udel.edu
Fri Aug 17 14:32:04 UTC 2012


The NTP timescale described on the NTP Era and Era Numbering page at the 
NTP Project site reckonds JDN days and fraction since noon on the first 
day of year 4613. The correspondence betwen JDN day and civil year prior 
to Pope Gregory's bull is in JDN years of 365.25 days , as is the habit 
of historians. The year since the papal bull corresponds to the 
Gregorian Calendar. The tables you see in the documentation were 
determined by an awesome Excel spreadsheet that apparently is unreadable 
with the current Excel version. Whatever bugs may remain are mine, but 
do not affect the current NTP timekeeping, only possible historic 


antony.arciuolo at oooii.com wrote:

>In http://www.ietf.org/rfc/rfc5905.txt and http://www.eecis.udel.edu/~mills/database/reports/ntp4/ntp4.pdf
>Figure 4: Interesting Historic NTP Dates/Table 2: Interesting Historic NTP Dates
>It seems to me that all MJD values in the table are calculated using Gregorian calculations all the way back. If I put in an "if before Gregorian was used" to do a different leap day calculation, then none of the pre-Gregorian values come out correctly.
>This is all true EXCEPT for the first test, the Julian Day Number Epoch. The document describes what should be "zero" for MJD, i.e. the exact constant that the offset is from regular JD. Using the Gregorian calculation for Julian Days, the value for Jan 1, -4712 is 38, not 0. Thus the MJD I get is -2399963, not -2400001. That's way more than any precision/noon v. midnight would produce.
>Why is that first date different algorithmically, if the test values are to be believed? It's not a Julian v. Gregorian thing because I can generate the other BCE dates consistently.
>Am I missing something? I feel like either the first MJD in the table is incorrect, or all BCE values are incorrectly calculated using Gregorian math in a non-Gregorian era.
>I am using code from http://www.tondering.dk/claus/calendar.html AND http://bowie.gsfc.nasa.gov/time/julian.txt (ported to C) for JDN calc and they are always self consistent (I do a assert(JDN1 == JDN2) to be sure I've got the calcs right). I also have a 3rd I did right from http://en.wikipedia.org/wiki/Julian_day, but that too produces 38.
>I can only get 0 JDN, thus -2400001 MJD with a non-Gregorian calculation, but then all BCE calcs + "Last day Julian" fail (the CE tests after "Last day Julian" all pass.
>Please, can someone shed some light on what I am missing? What are the rules NTP uses for calculating JDN?
>questions mailing list
>questions at lists.ntp.org

More information about the questions mailing list