| tsetyr |
|
Table of contents
Procedure
TSETYR ( Time --- set year expansion boundaries )
ENTRY TSETYR ( YEAR )
Abstract
Set the lower bound on the 100 year range.
Required_Reading
TIME
Keywords
TIME
Declarations
INTEGER YEAR
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 entry point is used to set the range to which years
abbreviated to the last two digits will be expanded, allowing all
of the SPICE time subsystem routines to handle uniformly the
expansion those "abbreviated" years (i.e. the remainder after
dividing the actual year by 100.) 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
IMPLICIT NONE
C
C Local parameters.
C
INTEGER DATELN
PARAMETER ( DATELN = 11 )
INTEGER NTSTRS
PARAMETER ( NTSTRS = 7 )
C
C Local variables.
C
CHARACTER*(DATELN) DATE (NTSTRS)
CHARACTER*(DATELN) TIMSTR
DOUBLE PRECISION ET
INTEGER I
C
C Assign an array of calendar dates.
C
DATA DATE / '00 JAN 21',
. '01 FEB 22',
. '48 MAR 23',
. '49 APR 24',
. '79 JUL 14',
. '80 FEB 02',
. '99 DEC 31' /
C
C Load the required LSK.
C
CALL FURNSH ( 'naif0012.tls' )
C
C Set up the lower bound for the
C expansion of abbreviated years.
C
CALL TSETYR ( 1980 )
C
C Expand the years in input time strings.
C
WRITE(*,*) 'Time string Expansion'
WRITE(*,*) '----------- -----------'
DO I = 1, NTSTRS
CALL STR2ET ( DATE(I), ET )
CALL TIMOUT ( ET, 'YYYY MON DD', TIMSTR )
WRITE(*,*) DATE(I), ' ', TIMSTR
END DO
END
When this program was executed on a Mac/Intel/gfortran/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)
Version
SPICELIB Version 2.1.0, 23-SEP-2020 (JDR)
Fixed bug: Added check 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.
Added TIME to the list of Required Readings. Extended
description in $Particulars to further describe the intended
use of this routine.
SPICELIB Version 2.0.0, 18-NOV-1997 (WLT)
The default century was change from 1950-2049 to 1969-2068.
SPICELIB Version 1.0.0, 08-APR-1996 (WLT)
|
Fri Dec 31 18:37:03 2021