Table of contents
CSPICE_TSETYR sets the lower bound on the 100 year range.
Given:
year the year associated with the lower bound on all year expansions
computed by the SPICELIB routine TEXPYR.
help, year
LONG = Scalar
For example if `year' is 1980, then the range of years that can
be abbreviated is from 1980 to 2079.
the call:
cspice_tsetyr, year
sets `year' as the lower bounds for two digit year value
evaluations.
None.
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
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.
PRO tsetyr_ex1
;;
;; Local parameters.
;;
DATELN = 12
NTSTRS = 7
;;
;; Assign an array of calendar dates.
;;
date = [ '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.
;;
cspice_furnsh, 'naif0012.tls'
;;
;; Set up the lower bound for the
;; expansion of abbreviated years
;;
cspice_tsetyr, 1980
;;
;; Expand the years in input time strings.
;;
print, 'Time string Expansion'
print, '----------- -----------'
for i=0, NTSTRS - 1L do begin
cspice_str2et, date(i), et
cspice_timout, et, 'YYYY MON DD', DATELN, timstr
print, date(i), ' ', timstr
endfor
;;
;; It's always good form to unload kernels after use,
;; particularly in IDL due to data persistence.
;;
cspice_kclear
END
When this program was executed on a Mac/Intel/IDL8.x/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
This routine allows all of the SPICE time subsystem to handle
uniformly the expansion of "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.
1) If `year' is less than 1, no action is taken.
2) If the input argument `year' is undefined, an error is
signaled by the IDL error handling system.
3) If the input argument `year' is not of the expected type, or
it does not have the expected dimensions and size, an error is
signaled by the Icy interface.
None.
None.
ICY.REQ
TIME.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.1.0, 10-AUG-2021 (JDR)
Fixed bug: Added check in underlying code for "year" to be positive in
order to update the lower bound for the expansion.
Updated the header to comply with NAIF standard. Added
complete code example to -Examples section.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections, and
completed -Particulars section.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added argument's type and size information in the -I/O section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
Set the interval of expansion for abbreviated years
|