wiki:drmsLeapSeconds

Version 1 (modified by niles, 9 years ago) (diff)

--

Leap Seconds

A leap second is inserted every few years so that the rotation of the earth according to the time is aligned with the stars. In NetDRMS, lead seconds are hard coded in an array. This means that NetDRMS needs to be recompiled to cope with the introduction of a leap second.

First, an update has to be made to the file base/libs/timeio/timeio.c, which has the hard coded array ut_leap_time[] encoded as :

static double ut_leap_time[] = {
/*
 *  Note: the times and amounts of adjustment prior to 1972.01.01 may be
 *    erroneous (they do not agree with those in the USNO list at
 *    ftp://maia.usno.navy.mil/ser7/tai-utc.dat), but they should not be
 *    changed without due care, as the calculation of utc_adjustment is
 *    based on a count of assumed whole second changes.
 */
-536543999.0,                                                /*  1960.01.01  */
-457747198.0,                                                /*  1962.07.01  */
-394588797.0,                                                /*  1964.07.01  */
-363052796.0,                                                /*  1965.07.01  */
-331516795.0,                                                /*  1966.07.01  */
-284083194.0,                                                /*  1968.01.01  */
-252460793.0,                                                /*  1969.01.01  */
-220924792.0,                                                /*  1970.01.01  */
-189388791.0,                                                /*  1971.01.01  */
-157852790.0,                                                /*  1972.01.01  */
-142127989.0,                                                /*  1972.07.01  */
-126230388.0,                                                /*  1973.01.01  */
 -94694387.0,                                                /*  1974.01.01  */
 -63158386.0,                                                /*  1975.01.01  */
 -31622385.0,                                                /*  1976.01.01  */
        16.0,                                                /*  1977.01.01  */
  31536017.0,                                                /*  1978.01.01  */
  63072018.0,                                                /*  1979.01.01  */
  94608019.0,                                                /*  1980.01.01  */
 141868820.0,                                                /*  1981.07.01  */
 173404821.0,                                                /*  1982.07.01  */
 204940822.0,                                                /*  1983.07.01  */
 268099223.0,                                                /*  1985.07.01  */
 347068824.0,                                                /*  1988.01.01  */
 410227225.0,                                                /*  1990.01.01  */
 441763226.0,                                                /*  1991.01.01  */
 489024027.0,                                                /*  1992.07.01  */
 520560028.0,                                                /*  1993.07.01  */
 552096029.0,                                                /*  1994.07.01  */
 599529630.0,                                                /*  1996.01.01  */
 646790431.0,                                                /*  1997.07.01  */
 694224032.0,                                                /*  1999.01.01  */
 915148833.0,                                                /*  2006.01.01  */
1009843234.0,                                                /*  2009.01.01  */
1120176035.0                                                 /*  2012.07.01  */
/*
 * IMPORTANT NOTE ---
 *   When adding a new leap second add time be sure to make changes in  BOTH
 *   this file and its near clone in /CM/src/timeio via your STAGING directory.
 *   
 *   The value to list is the time of the first second after the leap second.
 *   So, before the addition is made, get the seconds of the time in the
 *   comment via e.g. time_index or time_convert  then add 1 to it before
 *   adding it to the table.
 *
*/
/*
 *  ***  NOTE  Please notify mdiops@mdisas.nascom.nasa.gov at EOF
 *       whenever any of these times are updated!   ***
 */
};

Generally one more line will have to be added, something like :

1214784036.0                                                 /*  2015.07.01  */

Recompiling should involve 'make clean' followed by 'make' and followed again by 'make sums'. Each of these make steps should be repeated several times, until they give the same result on successive runs, before moving on to the next stage. Note that if NetDRMS has been customized, it is possible that the customizations may be lost in the 'make clean' step.