Index of Functions: A B C D E F G H I J K L M N O P Q R S T U V W X
Index Page tsetyr_c

Table of contents

Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input | Detailed_Output Parameters Exceptions Files Particulars Examples | Restrictions Literature_References Author_and_Institution Version Index_Entries

#### Procedure

       tsetyr_c ( Time --- set year expansion boundaries )

       void tsetyr_c ( SpiceInt            year )

#### Abstract

       Set the lower bound on the 100 year range

#### Required_Reading

       None.

#### Keywords

       TIME

#### Brief_I/O

       VARIABLE  I/O  DESCRIPTION
       --------  ---  --------------------------------------------------
       year       I   Lower bound on the 100 year interval of expansion

#### Detailed_Input

       year        is the year associated with the lower bound on all year
                   expansions computed by the SPICELIB routine TEXPYR. For
                   example if `year' is 1980, then the range of years that can
                   be abbreviated is from 1980 to 2079.

#### Detailed_Output

       None.

#### Parameters

       None.

#### Exceptions

       Error free.

       1)  If `year' is less than 1, no action is taken.

#### Files

       None.

#### Particulars

       This routine allows you to set the range to which years
       abbreviated to the last two digits will be expanded. The input
       supplied to this routine represents the lower bound of the
       expansion interval. The upper bound of the expansion interval
       is year + 99.

       The default expansion interval is from 1969 to 2068.

#### Examples

       The numerical results shown for this example may differ across
       platforms. The results depend on the SPICE kernels used as
       input, the compiler and supporting libraries, and the machine
       specific arithmetic implementation.

       1) Suppose that you need to manipulate time strings and that
          you want to treat years components in the range from 0 to 99
          as being abbreviations for years in the range from
          1980 to 2079 (provided that the years are not modified by
          an ERA substring). The example code below shows how you
          could go about this.

          Use the LSK kernel below to load the leap seconds and time
          constants required for the conversions.

             naif0012.tls

          Example code begins here.

          /.
             Program tsetyr_ex1
          ./
          #include <stdio.h>
          #include "SpiceUsr.h"

          int main( )
          {

             /.
             Local parameters.
             ./
             #define DATELN       12
             #define NTSTRS       7

             /.
             Local variables.
             ./
             SpiceChar            timstr [DATELN];

             SpiceDouble          et;

             SpiceInt             i;

             /.
             Assign an array of calendar dates.
             ./
             SpiceChar            date   [NTSTRS][DATELN] = {
                                       "00 JAN 21", "01 FEB 22", "48 MAR 23",
                                       "49 APR 24", "79 JUL 14", "80 FEB 02",
                                       "99 DEC 31" };

             /.
             Load the required LSK.
             ./
             furnsh_c ( "naif0012.tls" );

             /.
             Set up the lower bound for the
             expansion of abbreviated years.
             ./
             tsetyr_c ( 1980 );

             /.
             Expand the years in input time strings.
             ./
             printf( "Time string    Expansion\n" );
             printf( "-----------    -----------\n" );

             for ( i = 0; i < NTSTRS; i++ )
             {
                str2et_c ( date[i], &et );
                timout_c ( et, "YYYY MON DD", DATELN, timstr );

                printf( "%s      %s\n", date[i], timstr );
             }

             return ( 0 );
          }

          When this program was executed on a Mac/Intel/cc/64-bit
          platform, the output was:

          Time string    Expansion
          -----------    -----------
          00 JAN 21      2000 JAN 21
          01 FEB 22      2001 FEB 22
          48 MAR 23      2048 MAR 23
          49 APR 24      2049 APR 24
          79 JUL 14      2079 JUL 14
          80 FEB 02      1980 FEB 02
          99 DEC 31      1999 DEC 31

#### Restrictions

       None.

#### Literature_References

       None.

#### Author_and_Institution

       J. Diaz del Rio     (ODC Space)
       W.L. Taber          (JPL)
       E.D. Wright         (JPL)

#### Version

       -CSPICE Version 1.1.0, 05-JUL-2021 (JDR)

           Fixed bug: Added check in underlying code for "year" to be positive in
           order to update the lower bound for the expansion.

           Edited the header to comply with NAIF standard. Added complete
           code example.

           Removed information related to SPICELIB routine TEXPYR behavior
           from -Particulars.

       -CSPICE Version 1.0.0, 11-FEB-1998 (EDW) (WLT)

#### Index_Entries

       Set the interval of expansion for abbreviated years

#### Link to routine tsetyr_c source file tsetyr_c.c

    Fri Dec 31 18:41:14 2021