utils/SSEphem/astrtime.cc
int load_leap_sec_data()
{
    char line[100];
    int ln = 0;
    while ((fgets(line, 99, ls_stream) != NULL) && (ln < MAX_NUM_LEAP_SEC)) {
        // 50083.0	1996 January 1 TAI-UTC = 30.0
        if (sscanf(line, "%ld %s %s %s",
                   &ls[ln].mjd, &ls[ln].yr, &ls[ln].month, &ls[ln].day) < 4) {
            printf ("Error reading dates in leap second file '%s', line %d\n",
                    leap_sec_file, ln + 1);
            return 0;
        }
        // skip to the '='
	int i;
        for (i = 0; i < strlen(line); i++) {
            if (line[i] == '=') {
                break;
            }
        }
        if (sscanf(&line[i+1], "%lf", &ls[ln].utc_offset) != 1) {
            printf (
              "Error reading utc_offset in leap second file '%s', line %d\n",
                    leap_sec_file, ln + 1);
            return 0;
        }
        ln++;
    }
    if (ln == MAX_NUM_LEAP_SEC) {
        printf ("May have exceeded the leap second file length limit\n");
        printf (" of %d lines.  Recompile 'astrtime.cc'n", MAX_NUM_LEAP_SEC);
    }
    num_leap_sec = ln;
    return ln;
}
// This routine loads the leap second data structure, ls[], from the ascii
// leap second file.  If successful, it returns the number of leap second
// entries, otherwise it returns 0.  The ascii file format is
//    41498	1972 July 1    TAI-UTC = 11.0
//    41683	1973 January 1 TAI-UTC = 12.0
//    42048	1974 January 1 TAI-UTC = 13.0
//      :               :                 :
// The MJD must be the first field on each line, and the TAI-UTC value must
// be preceded by the '=' character.  The three year month day field are
// also expected.  Only the MJD and TAI-UTC values are actually used by the
// time routines, but the  year month day information is kept in the ls[]
// data structure.
This routine loads the leap second data structure, ls[], from the ascii
leap second file.  If successful, it returns the number of leap second
entries, otherwise it returns 0.  The ascii file format is
41498       1972 July 1    TAI-UTC = 11.0
41683       1973 January 1 TAI-UTC = 12.0
42048       1974 January 1 TAI-UTC = 13.0
:               :                 :
The MJD must be the first field on each line, and the TAI-UTC value must
be preceded by the '=' character.  The three year month day field are
also expected.  Only the MJD and TAI-UTC values are actually used by the
time routines, but the  year month day information is kept in the ls[]
data structure.
This routine loads the leap second data structure ls [] from the ascii leap second file . If successful it returns the number of leap second entries otherwise it returns 0 . The ascii file format is 41498 1972 July 1 TAI - UTC = 11 . 0 41683 1973 January 1 TAI - UTC = 12 . 0 42048 1974 January 1 TAI - UTC = 13 . 0 : : : The MJD must be the first field on each line and the TAI - UTC value must be preceded by the ' = ' character . The three year month day field are also expected . Only the MJD and TAI - UTC values are actually used by the time routines but the year month day information is kept in the ls [] data structure .
int load_leap_sec_data()
{
    char line[100];
    int ln = 0;
    while ((fgets(line, 99, ls_stream) != NULL) && (ln < MAX_NUM_LEAP_SEC)) {
        if (sscanf(line, "%ld %s %s %s",
                   &ls[ln].mjd, &ls[ln].yr, &ls[ln].month, &ls[ln].day) < 4) {
            printf ("Error reading dates in leap second file '%s', line %d\n",
                    leap_sec_file, ln + 1);
            return 0;
        }
	int i;
        for (i = 0; i < strlen(line); i++) {
            if (line[i] == '=') {
                break;
            }
        }
        if (sscanf(&line[i+1], "%lf", &ls[ln].utc_offset) != 1) {
            printf (
              "Error reading utc_offset in leap second file '%s', line %d\n",
                    leap_sec_file, ln + 1);
            return 0;
        }
        ln++;
    }
    if (ln == MAX_NUM_LEAP_SEC) {
        printf ("May have exceeded the leap second file length limit\n");
        printf (" of %d lines.  Recompile 'astrtime.cc'n", MAX_NUM_LEAP_SEC);
    }
    num_leap_sec = ln;
    return ln;
}
int load_leap_sec_data ( ) { char line [ 100 ] ; int ln = 0 ; while ( ( fgets ( line , 99 , ls_stream ) != NULL ) && ( ln < MAX_NUM_LEAP_SEC ) ) { if ( sscanf ( line , " " , & ls [ ln ] . mjd , & ls [ ln ] . yr , & ls [ ln ] . month , & ls [ ln ] . day ) < 4 ) { printf ( " \n " , leap_sec_file , ln + 1 ) ; return 0 ; } int i ; for ( i = 0 ; i < strlen ( line ) ; i ++ ) { if ( line [ i ] == ' ' ) { break ; } } if ( sscanf ( & line [ i + 1 ] , " " , & ls [ ln ] . utc_offset ) != 1 ) { printf ( " \n " , leap_sec_file , ln + 1 ) ; return 0 ; } ln ++ ; } if ( ln == MAX_NUM_LEAP_SEC ) { printf ( " \n " ) ; printf ( " " , MAX_NUM_LEAP_SEC ) ; } num_leap_sec = ln ; return ln ; }
This routine loads the leap second data structure, ls[], from the ascii
leap second file.
This routine loads the leap second data structure ls [] from the ascii leap second file .
// 50083.0	1996 January 1 TAI-UTC = 30.0 // skip to the '='